Why not use Webpack 5 ?
因为目前有些大型的项目还在依赖Webpack4,比如我正在用的Storybook和flareact。
如果安装最新版的各种loader,最常见的错误就是TypeError: this.getOptions is not a function
,所以要么开发时锁定loader版本,要么根据我下面的列表进行调整devDependencies。
Lastest version of Webpack4 loaders
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
Webpack4对于mjs文件处理存在问题,可以增加一条以下规则:
{ test: /\.mjs$/, include: /node_modules/, type: "javascript/auto", }