Module not found: Error: Can't resolve 'bundle.js' in...
$ npm run build > simple-app-demo@1.0.0 build D:\work\git\simple-app-demo > webpack app.js bundle.js Hash: af174d80108e932cdc49 Version: webpack 4.29.3 Time: 319ms Built at: 2019-02-15 10:52:12 1 asset Entrypoint main = main.js [0] multi ./app.js bundle.js 40 bytes {0} [built] [1] ./app.js 60 bytes {0} [built] + 1 hidden module WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'p roduction' 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 ./app.js bundle.js Module not found: Error: Can't resolve 'bundle.js' in 'D:\work\git\simple-app-demo' @ multi ./app.js bundle.js main[1] npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! simple-app-demo@1.0.0 build: `webpack app.js bundle.js` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the simple-app-demo@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! D:\Users\\AppData\Roaming\npm-cache\_logs\2019-02-15T02_52_12_529Z-debug.log
执行webpack打包的时候报错如上,解决方法:
把package.json里面的scripts命令修改为:
"build": "webpack app.js -o bundle.js",