vue-cli2+vue2:
安装
npm install --save babel-polyfill
main.js引入
import "babel-polyfill";
webpack.config.js 中,将 babel-polyfill 加到你的 entry 数组中
module.exports = {
entry: ["babel-polyfill", "./app/js"]
};
vue-cli4+vue2:
main.js 中添加
import 'core-js/stable';
import 'regenerator-runtime/runtime';
配置 babel.config.js
const plugins = [];
module.exports = {
presets: [["@vue/app", { useBuiltIns: "entry" }]],
plugins: plugins
};
网友评论