#Angular and Webpack keeps throwing warnings on invalid CSS comment syntax

2 messages · Page 1 of 1 (latest)

next crest
#

Hello there, I'm using npm run ng serve to build my Angular app. I use the latest Webpack 5+, and keep getting warnings about my CSS files:

$ npm run ng serve
[...]

Warning: ▲ [WARNING] Comments in CSS use "/* ... */" instead of "//" [js-comment-in-css]

    /Users/.../item.component.scss:1:18:
      1 │ /******/ (() => { // webpackBootstrap

My webpack.config.js is quite short, and as far as I understand, should do the job:

const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

module.exports = (config) => ({
    ...config,
    target: 'electron-renderer',
    plugins: [
        ...config.plugins,
        new NodePolyfillPlugin({
            excludeAliases: ["console"],
        }),
    ],
    module: {
        rules: [
            ...config.module.rules,
            {
                test: /\.scss$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader',
                ],
            },
        ],
    },
});

Could a misconfigured angular.json or tsconfig.json be the cause? Any help is highly appreciated!

bright crater
#

Check all your css files. Make sure you are not using single line comment