-
Notifications
You must be signed in to change notification settings - Fork 1.2k
regenerator-runtime/runtime
after regenerator-runtime
does not work
#337
Comments
I think we should clear the delete require.cache[require('./path').path] |
regenerator-runtime
does not workregenerator-runtime/runtime
after regenerator-runtime
does not work
Why not just define it globally (or better, just locally) yourself? Doing anything with |
So when I use a dependency using |
lost a few hours trying to figure out why the runtime was inexplicably disappearing in a webpack app. this seems like really weird behavio (i'm sure there is a reason). Why not have the module version not add a global and have a polyfill import that requires it and appends to the global object which is a lot more common of a pattern for these sorts of things.. |
Please note that #353 has landed as of |
Aha! I'm using |
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.
require('regenerator-runtime/runtime')
does not work ifregenerator-runtime
has been previously required.Repro repo.
The text was updated successfully, but these errors were encountered: