2

I am building an Angular app, and I use npm run ng serve to build it. I use the latest Webpack 5+, and keep getting errors about my CSS files:

Build at: 2024-11-17T02:48:50.801Z - Hash: 99f74102247761e6 - Time: 19195ms

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 have a misconfigured angular.json or tsconfig.json be the cause as well?

Any help is highly appreciated!

1
  • 1
    I have the same issue without using webpack (just ng build) and for me it popped up after changing some @import statements to @use Commented Jan 14 at 11:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.