From 27ca66ceea4edab11cbf1e347052c3c7e108efc4 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 15 May 2020 09:55:00 +0200 Subject: [PATCH] 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 --- .../angular-cli-files/plugins/common-js-usage-warn-plugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/common-js-usage-warn-plugin.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/common-js-usage-warn-plugin.ts index 26f016fdd4c5..fded2024ba04 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/common-js-usage-warn-plugin.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/common-js-usage-warn-plugin.ts @@ -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)) {