From 966a1334a6502f5d4a18710ae22e739e62770101 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 5 Nov 2021 08:59:46 +0100 Subject: [PATCH] fix(@angular-devkit/build-angular): suppress "@charset" must be the first rule in the file warning esbuild will issue a warning when `@charset` is in the middle of the file. This is caused by css-loader will concats the file and doesn't hoist `@charset`, (https://github.com/webpack-contrib/css-loader/issues/1212). While, esbuild will issue a warning regarding the above, it will hoist to the very top. In many cases, this warning is not actionable by the users as the `@charset` would be likely specified in 3rd party libs. Closes #22097 (cherry picked from commit b3e588801da324d84eb683eab4149274d58338e2) --- .../angular_devkit/build_angular/src/webpack/configs/common.ts | 3 +++ 1 file changed, 3 insertions(+) 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 fccfa085c5e4..b7e362aba026 100644 --- a/packages/angular_devkit/build_angular/src/webpack/configs/common.ts +++ b/packages/angular_devkit/build_angular/src/webpack/configs/common.ts @@ -364,6 +364,9 @@ export async function getCommonConfig( /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/, + // esbuild will issue a warning, while still hoists the @charset at the very top. + // This is caused by a bug in css-loader https://github.com/webpack-contrib/css-loader/issues/1212 + /"@charset" must be the first rule in the file/, ], module: { // Show an error for missing exports instead of a warning.