vue-cli: Promise.prototype.finally() broken in Firefox
Version
3.0.0-rc.10
Node and OS info
Node 10.6.0 / Yarn 1.9.2 / macOS 10.13.5
Steps to reproduce
- Clone https://github.com/mserajnik/vue-cli-promise-finally
- Install with Yarn
- Run with
yarn serve
- Open the development URL in Firefox (tested under Firefox
61.0.1
) - Check the console:
[Vue warn]: Error in created hook: "TypeError: this.fetchData(...).then(...).catch(...).finally is not a function"
What is expected?
According to the MDN web docs, Promise.prototype.finally()
is supported natively in Firefox since 58
, so it should work, even without any polyfill.
What is actually happening?
Promise.prototype.finally()
does not work in Firefox (61.0.1
).
Not sure if I’m missing something obvious here – I’m not even sure if this is actually a bug or just a configuration issue (maybe I have to adjust my babel.config.js
in some way?). What is weird is that Promise.prototype.finally()
works in Safari when I run the same test app, which doesn’t have native support for it apparently – so the polyfill seems to be working there. I can only reproduce the issue in Firefox. A friend has also confirmed the same issue in Firefox under Windows 10.
Oh, and sorry if this issue belongs somewhere else. Since I couldn’t pin down if it’s a Firefox bug, an issue with Babel or one with the @vue/app
preset (or just a configuration error on my end), it made the most sense to me to open it here first.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (6 by maintainers)
This is an issue in
core-js
- its promise polyfill replaces the native Promise in Firefox, however according to author of core-js, it is doing it because Firefox’s Promise implementation somehow fails a subclassing check so is technically not spec-compliant.For now I’ve included
es7.promise.finally
by default to fix this in Vue CLI.Doing the following seems to work:
It does increase the bundle size a bit (as expected), but that’s not really an issue.
According to this comment from Brian Ng:
So, issue solved for me. Do you think you could mention this limitation of having
useBuiltIns
inusage
mode somewhere in the readme of@vue/babel-preset-app
? I know that’s an issue/limitation with@babel/preset-env
itself, but given that@vue/cli
is pretty much zero config by default and very beginner-friendly for people who haven’t worked with webpack/Babel/etc. before, this is likely one of the first places they’d look if they encountered such an issue.Sorry to comment on a closed topic but I’m getting an error relative to the subject.
`This dependency was not found:
To install it, you can run: npm install --save core-js/modules/es7.promise.finally`
I’m getting the error AFTER the rc10, so I had to fix the version in rc10.
@ahussein3 This has been fixed in
v3.0.0-rc.11
in August 2018.Its fixed, I upgraded vue to the latest version. Its weird, because the version I had (2.5.17) had the changes made by @yyx990803… but anyways, its working now, thanks @mserajnik and @LinusBorg
Happens to me also after installing vue-styled-components