laravel Polyfill for IE

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41506836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:04:40  来源:igfitidea点击:

Polyfill for ie

javascriptlaravelvue.jsbabeljspolyfills

提问by Jamie

I'm trying to add a polyfillto my vue.js 2.0/Laravel5.3application because in internet explorer 11 I receive an error:

我正在尝试向polyfill我的vue.js 2.0/Laravel5.3应用程序添加一个,因为在 Internet Explorer 11 中我收到一个错误:

vuex requires a Promise polyfill in this browser.

So I've followed the docsI'm using ecm 6 so I did:

所以我遵循了我使用 ecm 6的文档,所以我做了:

npm install --save-dev babel-polyfill

And added this at the top in my bootstrap.js:

并在我的bootstrap.js的顶部添加了这个:

import "babel-polyfill";

But still the same error in Internet explorer. What should I do or what am I doing wrong here?

但在 Internet Explorer 中仍然出现相同的错误。我应该怎么做或者我在这里做错了什么?

采纳答案by Rashad Saleh

If you are using Webpack, find your webpack.base.conf.jsfile (mine was in the buildfolder), or the equivalent webpack configuration file, then modify the app entry variable to include babel-polyfillat the start so it looks something like this:

如果您使用的是 Webpack,请找到您的webpack.base.conf.js文件(我的在build文件夹中)或等效的 webpack 配置文件,然后修改 app 入口变量以包含babel-polyfill在开始处,使其看起来像这样:

entry: {
    app: ['babel-polyfill', ...]
  },
  .
  .
  .

回答by Jamie

@doulmi

@doulmi

Add this to your package.json file:

将此添加到您的 package.json 文件中:

 "babel-polyfill": "^6.20.0"

After that npm install.

在那之后npm install

Add this at the top of you main js file:

在主 js 文件的顶部添加:

import "babel-polyfill";

Compile everything. That should work.

编译一切。那应该有效。