Skip to content

Commit cc4afa2

Browse files
alan-agius4clydin
authored andcommitted
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`.
1 parent 7d57e5a commit cc4afa2

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import {
4444
getWatchOptions,
4545
normalizeExtraEntryPoints,
4646
} from '../utils/helpers';
47-
import { IGNORE_WARNINGS } from '../utils/stats';
4847

4948
// eslint-disable-next-line max-lines-per-function
5049
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
@@ -430,7 +429,15 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
430429
performance: {
431430
hints: false,
432431
},
433-
ignoreWarnings: IGNORE_WARNINGS,
432+
ignoreWarnings: [
433+
// Webpack 5+ has no facility to disable this warning.
434+
// System.import is used in @angular/core for deprecated string-form lazy routes
435+
/System.import\(\) is deprecated and will be removed soon/i,
436+
// https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83
437+
/Failed to parse source map from/,
438+
// https://github.com/webpack-contrib/postcss-loader/blob/bd261875fdf9c596af4ffb3a1a73fe3c549befda/src/index.js#L153-L158
439+
/Add postcss as project dependency/,
440+
],
434441
module: {
435442
// Show an error for missing exports instead of a warning.
436443
strictExportPresence: true,

packages/angular_devkit/build_angular/src/webpack/utils/stats.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,6 @@ function statsToString(
240240
}
241241
}
242242

243-
export const IGNORE_WARNINGS = [
244-
// Webpack 5+ has no facility to disable this warning.
245-
// System.import is used in @angular/core for deprecated string-form lazy routes
246-
/System.import\(\) is deprecated and will be removed soon/i,
247-
// https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83
248-
/Failed to parse source map from/,
249-
];
250-
251243
// eslint-disable-next-line @typescript-eslint/no-explicit-any
252244
export function statsWarningsToString(json: StatsCompilation, statsConfig: any): string {
253245
const colors = statsConfig.colors;

0 commit comments

Comments
 (0)