mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 04:26:01 +08:00
fix(@angular-devkit/build-angular): add link when displaying commonJS usage warnings
Add a link to https://web.dev/commonjs-larger-bundles when a commonJS module is used in browsers builds
This commit is contained in:
parent
6d0f13be7e
commit
27ca66ceea
@ -81,7 +81,8 @@ export class CommonJsUsageWarnPlugin {
|
|||||||
// And if the issuer request is not from 'webpack-dev-server', as 'webpack-dev-server'
|
// And if the issuer request is not from 'webpack-dev-server', as 'webpack-dev-server'
|
||||||
// will require CommonJS libraries for live reloading such as 'sockjs-node'.
|
// will require CommonJS libraries for live reloading such as 'sockjs-node'.
|
||||||
if (mainIssuer?.name === 'main' && !issuer?.userRequest?.includes('webpack-dev-server')) {
|
if (mainIssuer?.name === 'main' && !issuer?.userRequest?.includes('webpack-dev-server')) {
|
||||||
const warning = `${issuer?.userRequest} depends on ${rawRequest}. CommonJS or AMD dependencies can cause optimization bailouts.`;
|
const warning = `${issuer?.userRequest} depends on ${rawRequest}. CommonJS or AMD dependencies can cause optimization bailouts.\n` +
|
||||||
|
'For more info see: https://web.dev/commonjs-larger-bundles';
|
||||||
|
|
||||||
// Avoid showing the same warning multiple times when in 'watch' mode.
|
// Avoid showing the same warning multiple times when in 'watch' mode.
|
||||||
if (!this.shownWarnings.has(warning)) {
|
if (!this.shownWarnings.has(warning)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user