在使用webpack4命令行工具打包时:
webpack hello.js hello.bundle.js
结果报错如下:
ERROR in multi ./hello.js hello.bundle.js
Module not found: Error: Can’t resolve ‘hello.bundle.js’ in ‘C:\wangliang\study\webpack-demo’
@ multi ./hello.js hello.bundle.js main[1]
原因:而是webpack4 更新后对webpack语法进行了更严格的要求
解决办法:
webpack hello.js --output-filename hello.bundle.js --output-path . --mode development
或者webpack hello.js -o hello.bundle.js --mode development