New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack5升级过程遇到的一些坑? #26
Comments
在webpack5.x中,发现很多关于@babel/runtime/helpers/esm的文件引入错误,错误提示类似下面,通过锁定@babel/runtime包版本即可 貌似这个锁定也没用 |
还好发现这篇,watch 搞了一整天,感谢楼主 |
|
我的项目之前是基于webpack3的。直接升级感觉像抽盲盒一样,问题太多也不好定位。 升级过程还是比较顺利,遇到的唯一问题是css-loader升级到2.0的时候有问题。 接下去升级到webpack5基本上什么都没有做。 |
应该是esModule: false |
@JakeXu 谢谢,我现在也没有问题了。前几天发现很多包升级到了webpack5,全部升上去了。 ` |
怎么可能包更加大了,我升级完5,包体积减少了13m |
webpack5升级过程遇到的一些坑
版本相关信息
问题
Error: Cannot find module 'webpack-cli/bin/config-yargs'
在
webpack-cli 4.x
中,不能过webpack-dev-server
启动项目了,需要通过webpack serve...
或者修改webpack-cli
版本改为3.xwebpack5
中错误出现错误UnhandledPromiseRejectionWarning: TypeError: webpack.NamedModulesPlugin is not a constructor
@babel/runtime
在webpack5.x中,发现很多关于
@babel/runtime/helpers/esm
的文件引入错误,错误提示类似下面,通过锁定@babel/runtime包版本即可webpack < 5 used to include polyfills for node.js core modules by default
在运行过程中出现了很多这样的报错信息,是由于在webpack5中移除了nodejs核心模块的polyfill自动引入,所以需要手动引入,如果打包过程中有使用到nodejs核心模块,webpack会提示进行相应配置
Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
Mak`e sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
为⚠️ 信息,github issue
html-webpack-plugin
这个包导致的官方给出的问题原因是
webpack-cli
这个包的版本导致的,github issue不过我在本地创建了一个新的项目,版本信息如下,还是存在上面的那个报错信息,demo地址github issue
webpack-merge
包遇到的问题csdn资料
recoil
好像还不支持在webpack中使用,我们项目里有使用recoil,配置了babel后,一直提示You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
官方答复:guthub issue
TypeError: Cannot read property 'tap' of undefined
hard-source-webpack-plugin
这个包在版本升级后出现错误,github issuewebpack升级日志
The text was updated successfully, but these errors were encountered: