最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Angular and Webpack keep throwing exception on invalid CSS comment syntax - Stack Overflow

matteradmin7PV0评论

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!

Post a comment

comment list (0)

  1. No comments so far