react 关于 webpack 打包

"scripts":{
"start":"webpack-dev-server--content-basepublic/",
"stage":"NODE_ENV=stagingwebpack-p--config--progress",
"deploy":"NODE_ENV=productionwebpack-p--config--progress",
"debug":"NODE_ENV=debugwebpack-dev-server--content-basepublic/"
},
正常
npmstart
可以跑起来了
可运行
npmrundeploy
就报错了
$npmrundeploy
>react-scaffold@1.0.0deployE:\zan\www\webpack\react-scaffold
>NODE_ENV=productionwebpack-p--config--progress
'NODE_ENV'▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
npmERR!Windows_NT6.1.7601
npmERR!argv"D:\\nodejs\\node.exe""D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js""run""deploy"
npmERR!nodev4.0.0
npmERR!npmv2.14.2
npmERR!codeELIFECYCLE
npmERR!react-scaffold@1.0.0deploy:`NODE_ENV=productionwebpack-p--config--progress`
npmERR!Exitstatus1
npmERR!
npmERR!Failedatthereact-scaffold@1.0.0deployscript'NODE_ENV=productionwebpack-p--config--progress'.
npmERR!Thisismostlikelyaproblemwiththereact-scaffoldpackage,
npmERR!notwithnpmitself.
npmERR!Telltheauthorthatthisfailsonyoursystem:
npmERR!NODE_ENV=productionwebpack-p--config--progress
npmERR!Youcangettheirinfovia:
npmERR!npmownerlsreact-scaffold
npmERR!Thereislikelyadditionalloggingoutputabove.
npmERR!Pleaseincludethefollowingfilewithanysupportrequest:
npmERR!E:\zan\www\webpack\react-scaffold\npm-debug.log
而直接运行webpack-p正常
哪里写错了吗求大神指导一下呀
素胚勾勒不出你
浏览 531回答 2
2回答

芜湖不芜

NODE_ENV=production是linux设置变量的方法,windows需要用setsetNODE_ENV=production&&webpack-p--config--progress

holdtom

1.你得有webpack.production.js文件2.执行webpack--configwebpack.production.js
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript