react-dom.production.min.js:4408不变违规:最小化React错误#152;

时间:2019-05-03 10:36:43

标签: javascript reactjs html5 webpack

运行webPack4配置时出错:

我正在尝试在我的React应用程序中运行webpack4配置,并在浏览器中出现诸如react-dom.production.min.js:4408不变的违规:最小化的React错误#152;请访问https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=t以获取完整消息或使用非最小化的开发环境查看完整错误和其他有用的警告。

下面是我的webpack.config.js文件:

有人可以帮忙吗?

const webpack = require('webpack');
const path = require('path');

const UglifyJSPlugin = require('uglifyjs-webpack-plugin');


module.exports = {

module: {


    rules: [
    {
        test:[/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.svg$/],
        use: [{

        loader: 'url-loader'
        }
    ]
    },
    {
            include: [path.resolve(__dirname, 'src')],
            loader: 'babel-loader',

            options: {
                plugins: ['syntax-dynamic-import'],

                presets: [
                    [
                        '@babel/preset-env',
                        {
                            modules: false
                        }
                    ]
                ]
            },

            test: /\.js$/
        },

        {
            include: [path.resolve(__dirname, 'src')],
            loader: 'babel-loader',

            options: {
                plugins: ['syntax-dynamic-import'],

                presets: [
                    [
                        '@babel/preset-react',
                        {
                            modules: false
                        }
                    ]
                ]
            },

            test: /\.js$/
        },

        {
            test: /\.(scss|css)$/,

            use: [
                {
                    loader: 'style-loader'
                },
                {
                    loader: 'css-loader'
                },
                {
                    loader: 'sass-loader'
                }
            ]
        }
    ]
},

output: {

    filename: '[name].[chunkhash].js'
},

mode: 'development',

optimization: {
    splitChunks: {
        cacheGroups: {
            vendors: {
                priority: -10,
                test: /[\\/]node_modules[\\/]/
            }
        },

        chunks: 'async',
        minChunks: 1,
        minSize: 30000,
        name: true
    }
}
};

0 个答案:

没有答案