ember-cli / ember-cli/ember-cli-babel-polyfills
Regenerator runtime is not loaded in modern browsers
- Dominant language
- JavaScript
- Stars
- 33
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
This addon is supposed to include regenerator runtime into one of the polyfills and actually, it does include it in the legacy polyfill. However, the legacy polyfill is not loaded by modern browsers because of `nomodule` script attribute.
So, if the `targets.js` contains some legacy browsers which do not support async/await or generators the code gets transpiled by babel to use Regenerator runtime. So, when you run the app in a modern browser you end up in a situation when the code references `regeneratorRuntime` but the runtime is not there. `Uncaught (in promise) ReferenceError: regeneratorRuntime is not defined.`
Here is the reproduction repo: https://github.com/andreyfel/regenerator-runtime-bug
Most apps do not face the issue because `ember-maybe-import-regenerator` is in the default blueprint for Ember app. However, this addon is supposed to remove the need for that addon.
Also, ember-maybe-import-regenerator depends on a quite old version of the runtime. ember-cli-babel-polyfills has a much fresher version in dependencies.
I think the easiest fix for this would be to include regenerator runtime to the `shared` polyfill instead of the `legacy` one.
Contributor guide
Assessment
This issue has not been assessed yet.