webpack 打包报错 The 'mode' option has not been set, webpack will fallback to 'production'

19-04-18 18:34 字数 564 阅读 3013

在使用webpack打包时发现报了下面的错

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in multi ./hello.js hello.bundle.js
Module not found: Error: Can't resolve 'hello.bundle.js' in '/Applications/MAMP/htdocs/test.com/webpack-test'
 @ multi ./hello.js hello.bundle.js main[1]

这是因为webpack4之后对语法更加严格的原因,解决办法

webpack hello.js --output-filename hello.bundle.js --mode development
0人点赞>
关注 收藏 改进 举报
0 条评论
排序方式 时间 投票
快来抢占一楼吧
请登录后发表评论
站长 @ 十七度
文章
380
粉丝
23
喜欢
190
收藏
31
排名 : 1
访问 : 127.91万
私信