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
From what I can tell, it's not currently possible to run generators written as ESM modules/"type": "module". This is a feature request for that to be possible!
I took a look at the code and I think these lines in lib/store.js could be modified like so to support both CJS and ESM:
Of course, that's not the end of the story. Then every usage of this.generators[something], directly or transitively, must be updated to support asynchronous importing of generators. I would expect some public API methods would be affected. Also, dynamic import's module resolution strategy is different than require's.
So basically, this would definitely be a breaking change, but I think it's an essential change now that ESM is becoming the preferred module format.
Let me know if you'd like any help with this. I'd be keen to help! 😃
The text was updated successfully, but these errors were encountered:
Do you mean that ESM generators are already supported? I personally couldn't get it to work, but maybe I was doing something wrong.
Why not keep ">=12.10.0"? Not planning to change it.
I think that the earliest Node version where ESM, including dynamic import, is supported unflagged is v12.17.0. So you'd have to require ">= 12.17.0" at least if dynamic import is in your code (I think it's a syntax error prior to v12.17.0).
It won't be a breaking change.
Composing with a esm generator will have a different behavior, it will return a promise instead a generator.
Sure, I suppose you could try to have different behavior between CJS and ESM generators.
From what I can tell, it's not currently possible to run generators written as ESM modules/
"type": "module"
. This is a feature request for that to be possible!I took a look at the code and I think these lines in
lib/store.js
could be modified like so to support both CJS and ESM:Of course, that's not the end of the story. Then every usage of
this.generators[something]
, directly or transitively, must be updated to support asynchronous importing of generators. I would expect some public API methods would be affected. Also, dynamic import's module resolution strategy is different thanrequire
's.So basically, this would definitely be a breaking change, but I think it's an essential change now that ESM is becoming the preferred module format.
Let me know if you'd like any help with this. I'd be keen to help! 😃
The text was updated successfully, but these errors were encountered: