一直在用webpack-dev-server开发,一切正常。结果在用webpack打包时却出错了。错误信息非常长,终端都显示不全。。。出错的路径都在node_modules中,错误信息基本是这两个:
Module not found: Error: Cannot resolve module 'fs' in xxxxxxx
和 You may need an appropriate loader to handle this file type.(载入json文件时)。
但是,运行webpack-dev-server却能够正常运行,并且和webpack打包时用的是同一个config文件。
不明白为什么直接用webpack打包会出错?请问问题出在哪呢?
Solved, it turns out that I accidentally put --progress between --config and webpack.prod.config.js. I just adjusted it. . . What a stupid mistake. . .
It should be that the dependent package is missing. Try reinstalling the package. If you see something missing, install it.