-
Notifications
You must be signed in to change notification settings - Fork 4.4k
"vuex requires a promise polyfill in this browser" #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The only way I could get this error to stop was by including this in the
Hope there is a better solution, as I'm not pleased with this. |
@jaredreich is that supposed to mean that the Babel polyfill doesnt work or that you don't have that option for some reason? @DevanB so including the es6-promise polyfill in main.js as explained in #260 did not work? |
Hey Linus thanks for the reply. Babel-polyfill is fine as I use it actively in other non-vue projects. My point was we shouldn't have to do something hacky like inserting a lone/non-stansard require/import at the top of main.js, using the webpack entry property should work. Unfortunately I don't know how this is a problem with vuex's setup, but it's definitely not a webpack or babel-polyfill issue. |
If anyone else runs into this issue, I was able to get entry: {
app: [
'babel-polyfill',
'./src/main.js'
]
}, |
@LinusBorg Yep, I added es6-promise to the top of I tried putting the babel-polyfill in
|
The Problem is that import statements always get hoisted to the very top of the file, before any other code. Solution: use |
First, thanks for the help @LinusBorg! I didn't know that. So I changed the
|
@DevanB import 'es6-promise/auto' |
@limichange that worked! Again, thanks @LinusBorg for the help also (and the new knowledge!) I'll be glad to put in a PR for some documentation on the process, if wanted. This was the final solution:
|
No idea what I'm doing wrong, but I'm still getting the same error with @DevanB's final solution...
Edit: Got it working by adding files: [
'../../node_modules/es6-promise/dist/es6-promise.auto.js',
'./index.js'
] ...Still not sure why |
it also works for babel-polyfill. |
You can also just add |
Using
|
I just used If you don't use SSR/Nuxt, running components independently can lead to unexpected states that you would frequently encounter in unit tests. |
if you use axios npm install es6-promise. And then before axios scriptput this ---> require('es6-promise').polyfill(); |
Still have the same problem with ie11 SCRIPT 1010: expected identifier app.js (8549,1) below is my main.js file |
I solved it by add babel-polyfill like this: import Vuex from 'vuex'
import Vue from 'vue'
require('babel-polyfill')
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
increment (state) {
state.count++
}
}
})
export default store |
Re-raising this as I don't think it was solved in #260
We should just be able to install
babel-polyfill
and then:But that's a no go.
The text was updated successfully, but these errors were encountered: