-
-
Notifications
You must be signed in to change notification settings - Fork 111
feat: Support top-level await on Node 22.12+ #269
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
Conversation
import()
import()
after failed require
I can confirm this works for me and solves the problems I was having reported in this issue: #267 Is there anything stopping this being merged? |
I need to figure out a regression test for this because CI isn't failing in #272 when it should be. |
It looks like this will cause the failure: const dynamicNoop = await Promise.resolve(function noop(cb) {
cb();
});
export const registered = dynamicNoop;
export function exported(){};
export const string = 'no function'; |
import()
after failed require- supports node v22.12.0 and later when using top level await
174a192
to
fd1742b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work here @epelc! Sorry for the delay but we'll get this released shortly.
Thanks! Excited to get this in. Been blocking a node upgrade. Gulp works really well for auxiliary build steps around modern angular. |
Thanks for getting this merged and released 🙏 |
Fixes #268 which is broken on node v22.12.0 and later(works on <= v22.11.0). Gulp cli was trying to use
require()
, failing and not trying to fallback toimport()
since the error code changed. Previously gulp would detect the error and attempt to useimport()
.This makes it detect the new error code in node v22.12.0 and later. Keeps the old behavior to support older node versions as well.
See node change log which describes the changes that lead to this.
https://nodejs.org/en/blog/release/v22.12.0#requireesm-is-now-enabled-by-default