admin管理员组

文章数量:1435859

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/.../itemponent.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!

本文标签: Angular and Webpack keep throwing exception on invalid CSS comment syntaxStack Overflow