Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ykit关于发布到production环境react报错的问题 #43

Open
shmilyzzd opened this issue Jul 24, 2018 · 1 comment
Open

ykit关于发布到production环境react报错的问题 #43

shmilyzzd opened this issue Jul 24, 2018 · 1 comment

Comments

@shmilyzzd
Copy link

shmilyzzd commented Jul 24, 2018

使用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:
}

@honchy
Copy link
Member

honchy commented Sep 5, 2018

@shmilyzzd ,这个是 ykit 没有默认开启移除 deadCode 功能。你可以手动开启,开启方式如下:

ykit.js

module.exports = {
    "plugins": [
      
    ],
    build: {
        uglifyjs: {
            squeeze: {
                dead_code: true
            }
        }
    },
    "config": {
        "export": [
            "...."
        ]
    }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants