在终端中运行webpack命令时出现错误和警告。 “找不到模块:错误:无法解析'bundle.js'”

时间:2018-03-13 12:02:19

标签: webpack

我是webpack的初学者,我在此视频中编码:https://www.youtube.com/watch?v=lziuNMk_8eQ&t=560s

我遇到了第一步的问题。我在项目目录中通过“npm init”安装了webpack。然后我创建了一个index.html和一个app.js.然后我输入这个命令(我收到错误):

webpack app.js bundle.js

这是我收到的错误消息和警告:

Hash: bdfaf7d26353121c4df4
Version: webpack 4.1.1
Time: 122ms
Built at: 3/12/2018 9:14:55 PM
 1 asset
Entrypoint main = main.js
   [0] ./app.js 23 bytes {0} [built]
   [1] multi ./app.js bundle.js 40 bytes {0} [built]

WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment. 

ERROR in multi ./app.js bundle.js
Module not found: Error: Can't resolve 'bundle.js' in '/Users/toads/dev/leetcode-solutions'
 @ multi ./app.js bundle.js

1 个答案:

答案 0 :(得分:0)

您可以尝试webpack --mode developmentwebpack --mode production