webpack 线上发布优化

使用webpack -p
并且webpack.config.js 增加如下代码
var webpack = require(‘webpack’);

   plugins: [
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: JSON.stringify('production')
            }
        }),

        new webpack.optimize.UglifyJsPlugin({
            compress: {
                //supresses warnings, usually from module minification
                warnings: false
            }
        })


    ]

参考文档https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build

https://github.com/lcxfs1991/blog/issues/2

你可能感兴趣的:(react)