在IE浏览器中报错,报错信息如下:vuex requires a Promise polyfill in this browser.需要怎么处理
@qq524007127 U need a Promise polyfill. Search it in github!
@ktsn you can close this 😉
how to resolve this problem?
@suifengfengye Follow the instruction here: https://babeljs.io/docs/usage/polyfill/
To include the polyfill you need to require it at the top of the entry point to your application.
require("babel-polyfill");
If you are using ES6’s import syntax in your application’s entry point, you should instead import the polyfill at the top of the entry point to ensure the polyfills are loaded first:
import "babel-polyfill";
With webpack.config.js, add babel-polyfill to your entry array:
module.exports = {
entry: ['babel-polyfill', './app/js']
};
eg. if you use webpack, in webpack.config.js you can replace your
module.exports = {
entry: {
app: './src/main.js'
},
with
module.exports = {
entry: {
app: ['babel-polyfill', './src/main.js']
},
我的解决方式(两步):
首先:
npm install es6-promise -S
其次,在入口文件 main.js:
// 文件最上方
import 'es6-promise/auto'
参考:
es6-promise
"vuex requires a promise polyfill in this browser"
Most helpful comment
我的解决方式(两步):
首先:
其次,在入口文件 main.js:
参考:
es6-promise
"vuex requires a promise polyfill in this browser"