npm install --save babel-polyfill
在main.js中添加:
import es6Promise from "babel-polyfill"; es6Promise .polyfill();
在webpack.base.conf.js中修改
module.exports = { entry: ["babel-polyfill", "./app/js"] };
但是还是发现报错:
polyfill-eventsource added missing EventSource to window
这时候再下载event-source-polyfill模块
npm install event-source-polyfill --save-dev
并将webpack.base.conf.js修改为:
module.exports = { entry: ["event-source-polyfill", "babel-polyfill", "./app/js"] };
https://babeljs.io/docs/usage/polyfill/
https://github.com/vuejs-templates/webpack/issues/474
原文地址:https://www.cnblogs.com/undefined-h/p/8276330.html
时间: 2024-11-08 15:33:35