Webpack4中一个文件的未知单词错误

时间:2019-01-28 13:07:40

标签: webpack webpack-4

我有一个简单的问题,我想对于webpack 4专家。我在此代码上遇到未知字错误:

_::-moz-svg-foreign-content, :root .c-logo {  
    #{"[; "}width: 9.2rem#{" ;]" }; 
}

具体来说,它在第一个括号中出错。 '['。我对webpack 4的了解不多,我还无法找到解决问题的搜索google,所以我想我可以把它带到这里。我的webpack配置:

const HtmlWebPackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
var path = require('path');

module.exports = {

    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist')
    },

    watch: true,

    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader"
                }
            },

            {
                test: /\.html$/,
                use: [
                    {
                        loader: "html-loader",
                        options: { minimize: false }
                    }
                ]
            },

            {
                test: /\.s?css$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'sass-loader'
                ]
            },

            {
                test: /\.svg$/,
                loader: 'svg-inline-loader'
            },

            {
                test: /\.(jpg|png|gif)$/,
                use: {
                    loader: "file-loader",
                    options: {
                        name: "[path][name].[hash].[ext]",
                    },
                },
            }
        ]
    },

    plugins: [
        new HtmlWebPackPlugin({
            template: "./src/index.html",
            filename: "./index.html"
        }),

        new MiniCssExtractPlugin({
            filename:"[name].css",
            chunkFilename: "[id].css"
        })
    ]
}

0 个答案:

没有答案