webpack4 报错 Could not find plugin “proposal-class-static-block“. Ensure there is an entry in ./avail

处理js兼容性时webpack出错

使用babel-loader做js兼容性处理时,我安装完babel-loader后还需要安装@babel/core 和@babel/preset-env
但是在安装完毕后,运行webpack 命令,进行打包时,控制台报 “Could not find plugin “proposal-class-static-block“. Ensure there is an entry in ./available-plugins” 错误。 上网查了查,发现可以通过修改node_modules/@babel/preset-env/lib/available-plugins.js文件,但是很难找。
实际上这个问题,依然是包的版本问题。将@babel/core 和@babel/preset-env 的版本改为:
在这里插入图片描述
解决方案:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_57809042/article/details/129806391