vue 项目 在ie浏览器下页面显示为空

时间:2021-08-05 20:38:07
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