1、安装相关依赖
npm i -D @babel/[email protected]
npm i -D @babel/[email protected]
npm i -D [email protected]
// 语法中有 async await 等
npm i -D @babel/[email protected]
npm i -D @babel/[email protected]
2、babel.config.js
module.exports = {
presets: [
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
'@babel/preset-env', '@vue/cli-plugin-babel/preset'
],
plugins: [
'@babel/plugin-transform-runtime'
],
}
3、vue.config.js
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
// plugins: [
// ['@babel/plugin-transform-runtime']
// ]
}
}
}
]
}
}
}
标签:npm,es6,es5,vue,plugin,babel,转化,preset,runtime
From: https://www.cnblogs.com/rzl795/p/17881373.html