问题解决24:webpack配置babel时候报错ERROR in ./src/main.js Module build failed (from ./node_modules/babel-loade
报错:ERROR in ./src/main.jsModule 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,...
报错:
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没有学习。
更多推荐
所有评论(0)