使用es6 react.js,Webpack构建失败 [英] Webpack build fails with es6 react.js
问题描述
我使用React.js,Webpack,...道具语法,箭头函数。
I use React.js, Webpack, ...props syntax, arrow functions.
当我运行npm run build时,我收到此错误:
When I run "npm run build", I get this error:
来自UglifyJs的bundle.js中的错误
语法错误:意外的令牌punc«(»,预期的punc«:»[bundle.js:77854,15 ]
这是我的 debug.log
我的 webpack.config
如何成功运行构建?
我找到导致错误的行,这里是:
I found the line which causes the bug, here it is:
从'react-bootstrap-table'导入{BootstrapTable,TableHeaderColumn};
我不知道为什么。 :(
I don't know why. :(
没有它,我的所有ES6语法都可以正常工作和编译而没有任何错误。
Without it, all my ES6 syntax works and compiled without any errors.
任何帮助请
推荐答案
找到它。
React-Bootstrap-Table有依赖关系名为React-Modal。
React-Bootstrap-Table have a dependency named React-Modal.
我安装了React Modal npm install react-modal
没有 --save
或 - save-dev
。所以我的 package.json中没有列出React-Modal
。
I installed React Modal by npm install react-modal
without --save
or --save-dev
. So React-Modal wasn't not listed in my package.json
.
现在一切正常。
解决方案: npm install react-modal --save
这篇关于使用es6 react.js,Webpack构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!