You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
regeneratorRuntime is not defined when using generator #708
/Users/dominik/Code/microbundle-async/dist/out.js:1
var r=regeneratorRuntime.mark(e);function e(){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",42);case 1:case"end":return r.stop()}},r)}console.log(e());
^
ReferenceError: regeneratorRuntime is not defined
at Object.<anonymous> (/Users/dominik/Code/microbundle-async/dist/out.js:1:7)
at Module._compile (internal/modules/cjs/loader.js:1251:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)
at Module.load (internal/modules/cjs/loader.js:1100:32)
at Function.Module._load (internal/modules/cjs/loader.js:962:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
It works if I add import 'regenerator-runtime/runtime'; to the top of the js file but it would be great if I didn't have to guess that this extra import is required (and it won't be required in the modern build for example: node dist/out.modern.js works).
Or do you have a Babel config (.babelrc, babel.config.js, "babel" package.json field)?
We do have a babel config in the repo (although I will probably get rid of it once I have switched over to microbundle). I was able to reproduce the issue without any special files (just the code above).
Hmm - do you have a custom Babel configuration by chance? Microbundle should be generating code that targets Node 12+, which should never use Regenerator since generators are fully supported.
@YousefED your package.json has a browserslist configuration that is causing regenerator to be referenced. Specifically, the >0.2% clause will include obscure browsers for which caniuse/browserslist data is known to be incorrect, like QQ Browser and UC Browser (both of which have been Chrome/Webview-based for many years, but the compat data is based on 2016 tests).
@YousefED your package.json has a browserslist configuration that is causing regenerator to be referenced. Specifically, the >0.2% clause will include obscure browsers for which caniuse/browserslist data is known to be incorrect, like QQ Browser and UC Browser (both of which have been Chrome/Webview-based for many years, but the compat data is based on 2016 tests).
Ah thanks, I think that originated from React defaults from a different project. In any case, when I remove that from package.json, I still have the same issue.
Reacted by Patrick George Wyndham Smith and Torleif Halseth
@developit Not sure if you've seen my comment / would you prefer me to open a new issue? Let me know if there's any other way I help diagnose (or some hints to debug the issue myself)
Activity
developit commentedon Aug 22, 2020
This is a bug. I think it should be fixed by #707.
To clarify - are you using
microbundle --target node? Or do you have a Babel config (.babelrc,babel.config.js,"babel"package.json field)?domoritz commentedon Aug 22, 2020
Thanks for the quick response.
I am trying to move https://github.com/vega/vega over to microbundle and mainly target browsers. I ran into the problem above because of https://github.com/vega/vega/blob/a8e6991411c2c5c4805320f87276e9861e80d69c/packages/vega-statistics/src/numbers.js#L1.
We do have a babel config in the repo (although I will probably get rid of it once I have switched over to microbundle). I was able to reproduce the issue without any special files (just the code above).
domoritz commentedon Aug 22, 2020
So yeah, my issue is similar to #704 but I am not targeting node.
developit commentedon Aug 23, 2020
Alrighty. I need to double-check my fix there for the browser target.
domoritz commentedon Aug 23, 2020
Sweet. Thanks!
yovanoc commentedon Dec 2, 2020
@domoritz @developit Same error for me, there is a fix now?
domoritz commentedon Dec 2, 2020
I created my own rollup config: https://github.com/vega/vega/blob/master/rollup.config.js.
developit commentedon Dec 18, 2020
Fixed in 0.13. Please re-open if this is not working still.
jackmoxley commentedon Mar 19, 2021
This is happening for me in 0.13.0
eatsjobs commentedon May 18, 2021
Still have this error :( there's a patch for this behaviour?
developit commentedon Jun 3, 2021
Hmm - do you have a custom Babel configuration by chance? Microbundle should be generating code that targets Node 12+, which should never use Regenerator since generators are fully supported.
YousefED commentedon Jul 27, 2021
@developit I'm running into the same issue with the latest version, without having any custom Babel configuration.
Steps to reproduce:
In the output files (
dist), you'll notice several references toregeneratorRuntimedevelopit commentedon Jul 27, 2021
@YousefED your package.json has a
browserslistconfiguration that is causing regenerator to be referenced. Specifically, the>0.2%clause will include obscure browsers for which caniuse/browserslist data is known to be incorrect, like QQ Browser and UC Browser (both of which have been Chrome/Webview-based for many years, but the compat data is based on 2016 tests).YousefED commentedon Jul 27, 2021
Ah thanks, I think that originated from React defaults from a different project. In any case, when I remove that from package.json, I still have the same issue.
YousefED commentedon Aug 17, 2021
@developit Not sure if you've seen my comment / would you prefer me to open a new issue? Let me know if there's any other way I help diagnose (or some hints to debug the issue myself)