Using babel runtime, but still got `ReferenceError: Can't find variable: Promise`
See original GitHub issueI notice that Promise polyfill should be required.
But the question is, I am already using the babel runtime transformer to transform my code, and I got Object.assign()
working just fine. Only new Promise()
in whatwg fetch library throw error Can't find variable: Promise
.
I am currently using require('es6-promise').polyfill();
, and it works fine.
I am wondering why I still need promise polyfill since I am using babel runtime?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:7
Top Results From Across the Web
babel/plugin-transform-runtime
A plugin that enables the re-use of Babel's injected helper code to save on codesize.
Read more >Babel 7 - ReferenceError: regeneratorRuntime is not defined
Updated Answer: If you are using Babel 7.4.0 or newer, then @babel/polyfill has been deprecated. Instead, you will want to use the following ......
Read more >referenceerror can t find variable axios - metara.net
Runtime aspect of `HttpStatusCode` missing from JavaScript files. Basically the variable in Javascript can be anything that's valid according to ECMAScript 5.1 ...
Read more >How to fix regeneratorRuntime is not defined?
Solution · later learned that babel-polyfill is deprecated. So, to solve the regeneratorRuntime problem, do this: · Install regenerator-runtime
Read more >babel-loader - webpack
You can instead require the Babel runtime as a separate module to avoid the duplication. The following configuration disables automatic per-file runtime ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure if this is cool, but this is what I did:
This way I’m processing
whatwg-fetch
with Babel as well, sotransform-runtime
patches its Promise usage.import isomorphic-fetch
works as well because it requireswhatwg-fetch
, so it will still get processed by webpack with the above config.