Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): add link when displaying commonJS…
Browse files Browse the repository at this point in the history
… usage warnings

Add a link to https://web.dev/commonjs-larger-bundles when a commonJS module is used in browsers builds
  • Loading branch information
alan-agius4 authored and filipesilva committed May 18, 2020
1 parent 6d0f13b commit 27ca66c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export class CommonJsUsageWarnPlugin {
// 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'.
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.
if (!this.shownWarnings.has(warning)) {
Expand Down

0 comments on commit 27ca66c

Please sign in to comment.