node.js - webpack里set NODE_ENV=production,react依然有warning?
怪我咯
怪我咯 2017-04-17 12:09:14
0
3
237
怪我咯
怪我咯

走同样的路,发现不同的人生

모든 응답 (3)
巴扎黑

解决了,必须要在 plugins 里加上:

new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': '"production"' } })

才是正确姿势

    PHPzhong

    什么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...

        최신 다운로드
        더>
        웹 효과
        웹사이트 소스 코드
        웹사이트 자료
        프론트엔드 템플릿
        회사 소개 부인 성명 Sitemap
        PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!