天天看点

webpack学习坑点笔记

按照网上教程在未做配置情况下运行webpack打包出现以下错误:

ERROR in multi ./hello.js hello.bundle.js Module not found: Error: Can't resolve 'hello.bundle.js' in 'F:\AnderWork\webpack工具参考\hello' @ multi ./hello.js hello.bundle.js

解决方案:

注: 在webpack4+ 中必须指定输出文件配置: 学习可以使用以下命令(hello.js 为文件名)

* $ webpack hello.js –output-filename hello.bundle.js –output-path . –mode development