系统是windows,想用 webpack 打包 react 生产环境代码,package.json部分代码如下:
"scripts": {
"start": "node server.js",
"build": "set NODE_ENV=production && webpack -p --progress --profile --colors"
},
命令行敲入npm run build
后刷新网页,为什么console里依然有warning?
什么warning?
参考:undefined is not an object (evaluating 'process.env.NODE_ENV')
Note: by default, React will be in development mode. To use React in production mode, set the environment variable NODE_ENV to production (using envify or webpack's DefinePlugin). A minifier that performs dead-code elimination such as UglifyJS is recommended to completely remove the extra code present in development mode.
https://facebook.github.io/re...