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

saonian 发布于 04-18 18:34 303 点击
在使用webpack打包时发现报了下面的错 ```shell 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之后对语法更加严格的原因,解决办法 ```shell webpack hello.js --output-filename hello.bundle.js --mode development ```
0 评论

请登录后发表评论

saonian

all or nothing, now or never.

文章
回复
粉丝