Angular and Webpack keep throwing exception on invalid CSS comment syntax

Discussão em 'Angular' iniciado por Daniel Stephens, Novembro 17, 2024.

  1. 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!

    Continue reading...

Compartilhe esta Página