问题解决24:webpack配置babel时候报错ERROR in ./src/main.js Module build failed (from ./node_modules/babel-loade

报错:

ERROR in ./src/main.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /Users/mac/Documents/04前端学习/04code/01Vue/webpack-study/src/main.js:
As of v7.0.0-beta.55, we’ve removed Babel’s Stage presets.
Please consider reading our blog post on this decision at
https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
for more details. TL;DR is that it’s more beneficial in the
long run to explicitly add which proposals to use.
在这里插入图片描述
这种错就是最新的babel已经不是这样配置的了。

最新配置步骤:

npm install babel-loader babel-core babel-preset-env -D

npm i @babel/plugin-transform-runtime -D

npm i @babel/runtime -D

npm i @babel/core@^7.0.0 -D

npm i @babel/preset-env -D

npm i @babel/plugin-proposal-class-properties -D

npm i babel-loader @babel/core @babel/runtime @babel/preset-env @babel/plugin-proposal-class-properties @babel/plugin-transform-runtime -D


 "@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/runtime": "^7.4.5",
"babel-loader": "^8.0.6",

在这里插入图片描述

另外配置也要修改 在.babelrc文件中 要配置成

{
	 "presets": ["@babel/preset-env"],
	"plugins": ["@babel/plugin-transform-runtime","@babel/plugin-proposal-class-properties"]
}

这个问题是真难找,我没看官方文档,因为个人只是学习vue,对前置的node没有学习。

评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值