-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Refactor experimental-modules check into runMain #21350
Conversation
its worth noting this isn't just a refactor, it actually fixes a bug where the loader can't run cjs. i can't quite figure out the repro though. edit: moving this code ensures that the loop never happens. /cc @guybedford could you add a test for this? |
@devsnek well spotted on the failure case. Note that the failure case also exposes another bug that duplicate import executions of module jobs don't seem to be properly deduped through |
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.
would like to see a test per @devsnek if possible
(CI failure unrelated) |
test/es-module/test-esm-cjs-main.js
Outdated
assert.strictEqual(require.main.exports.asdf, 'asdf'); | ||
const path = require('path'); | ||
|
||
const entry = path.resolve(__dirname, '../fixtures/es-modules/cjs.js'); |
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.
isn't there like common.fixture or smth for this
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.
LGTM but it would be nice if the nit from @devsnek could be addressed before landing.
@guybedford is this ready to land? |
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.
Looks good aside from gus's comment
This is being reported as a regression in 10.5.0 already, see e.g. nodejs/help#1349 I’ve pushed a commit addressing @devsnek’s nit + adding a |
|
@devsnek it turns out because of this bug that test wasn't actually running to completion, and the file path was incorrect. I've resolved this here now. |
Merged in 883e1cd. |
PR-URL: #21350 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #21350 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
This provides a slightly cleaner separation, moving the top-level ESM load to higher up in the bootstrap as it should be.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes