Choose one: 馃檵 feature request
parcel build file.js
parcel build file.js
ReferenceError: regeneratorRuntime is not defined
If no browserslist is specified, assume async functions are supported if used.
Until I searched the specified note on the parcel website, I didn't know I needed to import the babel-polyfill module and/or specify browserslist in package.json
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |1.6.2
| Node |9.5.0
| Yarn |1.5.1
| Operating System | win x64
Or at least give a good terminal warning with a suggested fix, rather than having "regeneratorRuntime is not defined" shown in the browser console.
Yes please! Took me hours to figure out the problem! I'm currently writing a Chrome extension where I can expect users to use a new version with async/await
support.
I get the error even with babel.
Not sure if this should be fixed as we currently set a default to browserlist that doesn't assume async is support (as it includes IE11).
We could however probably document this properly?
Perhaps we could install the polyfill by default though (if async is used)?
Meet the same error in latest browser.
Add import 'babel-polyfill'
in entry file works temporarily.
@Jancat temporarily?
You can stop supporting IE, by changing the browserfield in package.json
or created a browserlist config. Than it should work without polyfill.
If the polyfill is causing any issues that might be a problem with the polyfill and should be filled in the Babel repo, but I guess this wasn't what you meant?
@DeMoorJasper I'm building an H5 app and targeting moder mobiles. I set the browserslist
field in package.json
"browserslist": [
"Android >= 6.0",
"iOS >= 10.3"
]
The Async functions
support __Android 5, iOS 10.3 and Chrome 42__ in caniuse
But I debug in latest Chrome(v67) and the console throw the regeneratorRuntime
error:
Uncaught ReferenceError: regeneratorRuntime is not defined
I had to import 'babel-polyfill
to make it works.
That's strange perhaps that's a bug from Babel, not sure why this is happening @Jancat
@DeMoorJasper From Babel? But I use TypeScript
in my project, no Babel except the babel-polyfill
.
Is bug from Parcel TypeScript loader?
Parcel runs the javascript output from TS through babel to fit the browserlist
Using 1.9.7
I was able to fix this by adding the following to our package.json:
"browserslist": [
"last 1 Chrome version"
]
This stopped it from doing the incomplete transpilation on the async/await functions.
Hope this helps.
This is never gonna happen, as far as I know changing the default value dynamically isn't a good idea.
This will cause nasty side-effects, require lot's of documentation, cause issues and people still rely on old browsers.
Gonna close this issue as it will never get fixed.
Note: Once Babel 7 support lands we'll try to use useBuiltins
for preset-env, so this error will never occur as it will just bundle in the polyfills automatically.
Most helpful comment
Or at least give a good terminal warning with a suggested fix, rather than having "regeneratorRuntime is not defined" shown in the browser console.