-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
node 20.1.0 --loader seems trigger beforeExit when use await import #47929
Comments
also reported here - with a minimal repro // file.js
process.on('beforeExit', () => {
console.log('beforeExit')
})
import('./anyfile.js')
console.log('THIS CONSOLE LOG IS PREINTED') ./node file.js ✔
THIS CONSOLE LOG IS PREINTED
beforeExit ./node --experimental-loader="data:text/javascript,export default true" file.js ✔
(node:62415) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
THIS CONSOLE LOG IS PREINTED
beforeExit
beforeExit
beforeExit |
This is probably because the ESM loader uses Refs: https://nodejs.org/dist/latest-v20.x/docs/api/process.html#event-beforeexit /cc @aduh95 |
The underlying issue being that |
PR-URL: nodejs#47964 Fixes: nodejs#47929 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
PR-URL: nodejs/node#47964 Backport-PR-URL: nodejs/node#50669 Fixes: nodejs/node#47929 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
PR-URL: nodejs/node#47964 Backport-PR-URL: nodejs/node#50669 Fixes: nodejs/node#47929 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Version
20.1.0
Platform
macos
What do you see instead?
My module will close the redis connection at the time of beforeExit, and the await import module (19.9.0) will not trigger beforeExit before.
In addition, the exit event is not triggered when use await import module
The text was updated successfully, but these errors were encountered: