Webpack 4 Module parse failed: Unexpected character '@' (1:0)

后端 未结 3 718
北海茫月
北海茫月 2021-02-14 06:34

I get this error when i try to run npm run dev to compile my scss to css. I know that issue is related to @import

ERROR in ./src/scss/m

3条回答
  •  情歌与酒
    2021-02-14 06:45

    I fixed these similar issue by following these link.

    I updated rule section of webpack.config.js as follows

    rules: [
        {
                test: /\.css$/,
                use : [
                    {
                            loader: 'style-loader',
                    },
                    {
                            loader: 'css-loader',
                            options: {
                                    sourceMap: true,
                            }
                    }
                ]
        }
    ]
    

    Then installed the dependencies as follows.

    using yarn

    yarn add style-loader --dev
    yarn add css-loader --dev
    

    using npm

    npm install style-loader --save-dev
    npm install css-loader --save-dev
    

提交回复
热议问题