module: fix extensionless entry with explicit type=commonjs#61600
Open
inoway46 wants to merge 8 commits intonodejs:mainfrom
Open
module: fix extensionless entry with explicit type=commonjs#61600inoway46 wants to merge 8 commits intonodejs:mainfrom
inoway46 wants to merge 8 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
joyeecheung
reviewed
Jan 31, 2026
Member
joyeecheung
left a comment
There was a problem hiding this comment.
Thanks for the PR, a couple of comments, otherwise this looks good.
joyeecheung
reviewed
Feb 1, 2026
joyeecheung
reviewed
Feb 6, 2026
joyeecheung
approved these changes
Feb 7, 2026
Collaborator
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61600 +/- ##
==========================================
- Coverage 89.76% 89.74% -0.03%
==========================================
Files 673 675 +2
Lines 203944 204511 +567
Branches 39191 39305 +114
==========================================
+ Hits 183080 183540 +460
- Misses 13194 13248 +54
- Partials 7670 7723 +53
🚀 New features to boost your workflow:
|
Author
|
Thanks for the approval. I also verified |
ljharb
reviewed
Feb 7, 2026
joyeecheung
approved these changes
Feb 8, 2026
Collaborator
marco-ippolito
approved these changes
Feb 8, 2026
Collaborator
Member
|
@inoway46 Can you squash the commits? I don't think they would pass the test individually. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an extensionless entry point contains ESM syntax but is in a package with "type": "commonjs" in package.json, the module would silently exit with code 0 without executing or showing any error. This happened because extensionless files skip the
.jssuffix check in the CJS loader, so the explicittype: commonjswas not being enforced, allowing ESM syntax to be silently delegated to ESM loading which never completed before the process exited.This change ensures the CJS loader treats extensionless entry points as commonjs when
typeis explicitly set to "commonjs" in package.json, forcing ESM syntax to surface as a SyntaxError instead of silently exiting.Fixes: #61104
Related: #61171 (alternative approach)