-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Global variable is not defined in babel 6 / webpack 3 #363
Comments
See #353. With This is all handled for you if you use |
Then probably this readme file should be changed accordingly: https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/README.md It also goes to npm page of the regenerator-runtime and gets people like me confused |
This appears to also breaks Jest tests. Per these docs, one is supposed to add Tests fail with Tried with both Jest version 23.6.0 and 24.0.0-alpha.9. |
Per chance, did you happen to figure out a fix for this besides a downgrade? Thanks. |
@vincro - nope. I've set |
In #353, I simplified the implementation of regenerator-runtime by converting runtime.js to a normal CommonJS module. No more global object detection, and no more sneaky capture/deletion of regeneratorRuntime. Unfortunately, folks who use only @babel/polyfill and not @babel/transform-runtime may have existing code that relies on a global regeneratorRuntime variable. That code will eventually disappear (:crossed-fingers:), but in the meantime we can continue supporting it by simply ensuring that regeneratorRuntime is defined globally as a side-effect of importing regenerator-runtime. This turns out to be much easier than detecting the global object, as long as runtime.js runs as a non-strict CommonJS module. See my code comments for another fallback solution that should cover all remaining cases. Background discussion: babel/babel#7646 (comment) Fixes #363. Fixes #337. Fixes #367.
* Define regeneratorRuntime globally as a side-effect, again. In #353, I simplified the implementation of regenerator-runtime by converting runtime.js to a normal CommonJS module. No more global object detection, and no more sneaky capture/deletion of regeneratorRuntime. Unfortunately, folks who use only @babel/polyfill and not @babel/transform-runtime may have existing code that relies on a global regeneratorRuntime variable. That code will eventually disappear (:crossed_fingers:), but in the meantime we can continue supporting it by simply ensuring that regeneratorRuntime is defined globally as a side-effect of importing regenerator-runtime. This turns out to be much easier than detecting the global object, as long as runtime.js runs as a non-strict CommonJS module. See my code comments for another fallback solution that should cover all remaining cases. Background discussion: babel/babel#7646 (comment) Fixes #363. Fixes #337. Fixes #367. * Update regenerator/package-lock.json. * Fix Travis CI tests by running `npm i` instead of `npm ci`. * Prevent Travis from running `npm ci` by default.
Ouch, yeah many outdated docs on this in the world. Just got bit. |
I'm using babel v6.26.3 and webpack 3.12.0
If I call regenerrator-runtime as
import 'regenerator-runtime/runtime'
to define a global variable the code results to beSTART
END
Which means "regeneratorRuntime" is never registered as a global variable and the code stops to work.
This is happening in 0.13.1, I moved to 0.12.1 and everything is working fine there.
The text was updated successfully, but these errors were encountered: