您当前正在使用NODE_ENV === "production"之外的缩小代码



我收到这样的错误

You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.

我最近将我的项目从角度 6 升级到角度 9。

我也试过 1("webpack:server": "webpack --mode production --config webpack.server.config.js --progress --colors", 2("webpack:server": "webpack -p --config webpack.server.config.js --progress --colors", 3(新的网络包。DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production'( } }) 4(新的网络包。DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production'( })

5)new webpack.optimize.UglifyJsPlugin({
include: /.min.js$/,
minimize: true
})

"webpack:server": "webpack --mode production --config webpack.server.config.js --progress --colors">

这在我的项目中有效。 编辑包后运行 webpack.json

最新更新