From cc4afa2de6f45a55fc1a9fe7af284ab5e9f85cf6 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 11 Jun 2021 14:36:59 +0200 Subject: [PATCH] refactor(@angular-devkit/build-angular): ignore postcss-loader warning Users should not install `postcss` in their workspace as this is a dependency of `@angular-devkit/build-angular`. --- .../build_angular/src/webpack/configs/common.ts | 11 +++++++++-- .../build_angular/src/webpack/utils/stats.ts | 8 -------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/webpack/configs/common.ts b/packages/angular_devkit/build_angular/src/webpack/configs/common.ts index 4c9f83fad9..313eb3b141 100644 --- a/packages/angular_devkit/build_angular/src/webpack/configs/common.ts +++ b/packages/angular_devkit/build_angular/src/webpack/configs/common.ts @@ -44,7 +44,6 @@ import { getWatchOptions, normalizeExtraEntryPoints, } from '../utils/helpers'; -import { IGNORE_WARNINGS } from '../utils/stats'; // eslint-disable-next-line max-lines-per-function export function getCommonConfig(wco: WebpackConfigOptions): Configuration { @@ -430,7 +429,15 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration { performance: { hints: false, }, - ignoreWarnings: IGNORE_WARNINGS, + ignoreWarnings: [ + // Webpack 5+ has no facility to disable this warning. + // System.import is used in @angular/core for deprecated string-form lazy routes + /System.import\(\) is deprecated and will be removed soon/i, + // https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83 + /Failed to parse source map from/, + // https://github.com/webpack-contrib/postcss-loader/blob/bd261875fdf9c596af4ffb3a1a73fe3c549befda/src/index.js#L153-L158 + /Add postcss as project dependency/, + ], module: { // Show an error for missing exports instead of a warning. strictExportPresence: true, diff --git a/packages/angular_devkit/build_angular/src/webpack/utils/stats.ts b/packages/angular_devkit/build_angular/src/webpack/utils/stats.ts index a6f59294e5..f0b9c91dda 100644 --- a/packages/angular_devkit/build_angular/src/webpack/utils/stats.ts +++ b/packages/angular_devkit/build_angular/src/webpack/utils/stats.ts @@ -240,14 +240,6 @@ function statsToString( } } -export const IGNORE_WARNINGS = [ - // Webpack 5+ has no facility to disable this warning. - // System.import is used in @angular/core for deprecated string-form lazy routes - /System.import\(\) is deprecated and will be removed soon/i, - // https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83 - /Failed to parse source map from/, -]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any export function statsWarningsToString(json: StatsCompilation, statsConfig: any): string { const colors = statsConfig.colors;