Open shmilyzzd opened 5 years ago
@shmilyzzd ,这个是 ykit 没有默认开启移除 deadCode 功能。你可以手动开启,开启方式如下:
ykit.js
module.exports = {
"plugins": [
],
build: {
uglifyjs: {
squeeze: {
dead_code: true
}
}
},
"config": {
"export": [
"...."
]
}
};
使用ykit打包到production环境,前端页面报 React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production,但在ykit.config.js里面,发现production的配置没有问题,配置如下,麻烦问下如何解决,线上环境NODE_ENV为production modifyWebpackConfig: function (baseConfig) { var ENV_PARAMS = {}; switch (this.env) { case 'local': ENV_PARAMS = 'dev'; break; case 'dev': ENV_PARAMS = 'dev'; break; case 'prd': ENV_PARAMS = 'production'; break; default: }