webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined

打包是成功的。但是页面无法显示:

webpack版本不同,使用方法及不同:

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第1张图片

 

解决办法:

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第2张图片

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第3张图片

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第4张图片

 

 

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第5张图片

 

 

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第6张图片

参考:

https://zhuanlan.zhihu.com/p/34614789

https://vuejs.org/v2/guide/deployment.html

 

 

******************************

这个地方、上下2种代码都可以用。但是报错不同。

mode: '"production"':

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第7张图片

NODE_ENV: "production":

webpack报错:Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined_第8张图片

 

 

你可能感兴趣的:(webpack)