René's URL Explorer Experiment


Title: [25.x] module: fix extensionless CJS files in type:module packages by mcollina · Pull Request #62083 · nodejs/node · GitHub

Open Graph Title: [25.x] module: fix extensionless CJS files in type:module packages by mcollina · Pull Request #62083 · nodejs/node

X Title: [25.x] module: fix extensionless CJS files in type:module packages by mcollina · Pull Request #62083 · nodejs/node

Description: PR #61600 made the CJS loader respect the `package.json` `type` field for extensionless files, which fixed #61104 but also enforced `type: "module"` for extensionless files. This broke CJS extensionless files inside ESM packages (e.g. yargs v17). Only enforce `type: "commonjs"` for extensionless files. For `type: "module"`, leave format undefined so syntax detection handles it. This restores the documented exception in the CJS documentation that has existed since v16: when the nearest parent `package.json` file contains a top-level field `"type"` with a value of `"module"`, those files will be recognized as CommonJS modules only if they are being included via `require()`, not when used as the command-line entry point of the program This PR is targeted at `v25.x-staging` only. On `main` (v26), #61600 stays as-is and the exception should be removed from the CJS documentation in a separate PR to align the docs with the ESM resolution specification. Fixes: #61971 Refs: yargs/yargs#2509 Refs: #61600

Open Graph Description: PR #61600 made the CJS loader respect the `package.json` `type` field for extensionless files, which fixed #61104 but also enforced `type: "module"` for extensionless files. This broke CJ...

X Description: PR #61600 made the CJS loader respect the `package.json` `type` field for extensionless files, which fixed #61104 but also enforced `type: "module"` for extensionless files. This ...

Opengraph URL: https://github.com/nodejs/node/pull/62083

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:66aced7d-0676-97a8-e95b-dba1d4e17ab1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8A24:354A24:3C11D1:4F5235:6A4C3FDF
html-safe-nonceff5f9f22a112665fe48a0dafd4735641a9b84b68574cf0abf6a748db777732d3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTI0OjM1NEEyNDozQzExRDE6NEY1MjM1OjZBNEMzRkRGIiwidmlzaXRvcl9pZCI6Ijc5NTkwNTQxMzE5Mzg0NzU5OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca8f25f2fabbab94bec83fabdfdb0301387781eba28fa765a996bb5f7f1fd9e93
hovercard-subject-tagpull_request:3348120510
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/62083/files
twitter:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
og:image:altPR #61600 made the CJS loader respect the `package.json` `type` field for extensionless files, which fixed #61104 but also enforced `type: "module"` for extensionless files. This broke CJ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3996b3b83990e134be6c099ab9a7f48f140ae80f
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/62083/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F62083%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F62083%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/62083/files
Reloadhttps://github.com/nodejs/node/pull/62083/files
Reloadhttps://github.com/nodejs/node/pull/62083/files
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 967 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
aduh95https://github.com/aduh95
nodejs:v25.x-staginghttps://github.com/nodejs/node/tree/v25.x-staging
mcollina:fix/extensionless-cjs-in-type-modulehttps://github.com/mcollina/node/tree/fix/extensionless-cjs-in-type-module
Conversation 70 https://github.com/nodejs/node/pull/62083
Commits 1 https://github.com/nodejs/node/pull/62083/commits
Checks 76 https://github.com/nodejs/node/pull/62083/checks
Files changed https://github.com/nodejs/node/pull/62083/files
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
[25.x] module: fix extensionless CJS files in type:module packages https://github.com/nodejs/node/pull/62083/files#top
Show all changes 1 commit https://github.com/nodejs/node/pull/62083/files
9842d3e module: fix extensionless CJS files in type:module packages mcollina Mar 9, 2026 https://github.com/nodejs/node/pull/62083/commits/9842d3e1a74f8d8ef1a6fec1190fae27d076a2be
Clear filters https://github.com/nodejs/node/pull/62083/files
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
loader.js https://github.com/nodejs/node/pull/62083/files#diff-5b5902273122e094ff474fda358605ffa45a4a58b51cd0bf4c1acb93779df142
test-extensionless-esm-type-commonjs.js https://github.com/nodejs/node/pull/62083/files#diff-6a2e1b7062f59c6d1e549319f3087cb17ae0de2f713af5faa85ded3c970a3270
index https://github.com/nodejs/node/pull/62083/files#diff-7e1264aa8117551622f80f1acc4a4cf26776b5b2a6c43306664abebdfed67d07
package.json https://github.com/nodejs/node/pull/62083/files#diff-a693b5b7523bcf76a7e138d6be2ac3ec5194c99af47dc1f16f8414ab5f1108d5
lib/internal/modules/cjs/loader.jshttps://github.com/nodejs/node/pull/62083/files#diff-5b5902273122e094ff474fda358605ffa45a4a58b51cd0bf4c1acb93779df142
View file https://github.com/mcollina/node/blob/9842d3e1a74f8d8ef1a6fec1190fae27d076a2be/lib/internal/modules/cjs/loader.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62083/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/62083/files#diff-5b5902273122e094ff474fda358605ffa45a4a58b51cd0bf4c1acb93779df142
28vsp2qx6n-collabhttps://github.com/28vsp2qx6n-collab
Mar 13, 2026https://github.com/nodejs/node/pull/62083/files#r2931029583
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
GeoffreyBoothhttps://github.com/GeoffreyBooth
Mar 9, 2026https://github.com/nodejs/node/pull/62083/files#r2906444640
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
our docshttps://nodejs.org/docs/latest-v24.x/api/packages.html#syntax-detection
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
joyeecheunghttps://github.com/joyeecheung
Mar 9, 2026https://github.com/nodejs/node/pull/62083/files#r2906532841
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#61600https://github.com/nodejs/node/pull/61600
#61600https://github.com/nodejs/node/pull/61600
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
GeoffreyBoothhttps://github.com/GeoffreyBooth
Mar 9, 2026https://github.com/nodejs/node/pull/62083/files#r2908404776
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://nodejs.org/docs/v25.7.0/api/modules.html#enablinghttps://nodejs.org/docs/v25.7.0/api/modules.html#enabling
node/lib/internal/modules/esm/get_format.jshttps://github.com/nodejs/node/blob/17c76c1775cd7a50973e8cdf2e258415851b3ba7/lib/internal/modules/esm/get_format.js#L148-L150
17c76c1https://github.com/nodejs/node/commit/17c76c1775cd7a50973e8cdf2e258415851b3ba7
#61600https://github.com/nodejs/node/pull/61600
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
joyeecheunghttps://github.com/joyeecheung
Mar 10, 2026https://github.com/nodejs/node/pull/62083/files#r2909048381
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#61600https://github.com/nodejs/node/pull/61600
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
GeoffreyBoothhttps://github.com/GeoffreyBooth
Mar 10, 2026https://github.com/nodejs/node/pull/62083/files#r2914957817
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
joyeecheunghttps://github.com/joyeecheung
Mar 11, 2026https://github.com/nodejs/node/pull/62083/files#r2915432379
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#62176https://github.com/nodejs/node/pull/62176
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
guybedfordhttps://github.com/guybedford
Mar 4, 2026https://github.com/nodejs/node/pull/62083/files#r2885490199
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
https://github.com/nodejs/node/pull/62083/files#diff-5b5902273122e094ff474fda358605ffa45a4a58b51cd0bf4c1acb93779df142
test/es-module/test-extensionless-esm-type-commonjs.jshttps://github.com/nodejs/node/pull/62083/files#diff-6a2e1b7062f59c6d1e549319f3087cb17ae0de2f713af5faa85ded3c970a3270
View file https://github.com/mcollina/node/blob/9842d3e1a74f8d8ef1a6fec1190fae27d076a2be/test/es-module/test-extensionless-esm-type-commonjs.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62083/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/62083/files#diff-6a2e1b7062f59c6d1e549319f3087cb17ae0de2f713af5faa85ded3c970a3270
test/fixtures/es-modules/extensionless-cjs-module/indexhttps://github.com/nodejs/node/pull/62083/files#diff-7e1264aa8117551622f80f1acc4a4cf26776b5b2a6c43306664abebdfed67d07
View file https://github.com/mcollina/node/blob/9842d3e1a74f8d8ef1a6fec1190fae27d076a2be/test/fixtures/es-modules/extensionless-cjs-module/index
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62083/{{ revealButtonHref }}
test/fixtures/es-modules/extensionless-cjs-module/package.jsonhttps://github.com/nodejs/node/pull/62083/files#diff-a693b5b7523bcf76a7e138d6be2ac3ec5194c99af47dc1f16f8414ab5f1108d5
View file https://github.com/mcollina/node/blob/9842d3e1a74f8d8ef1a6fec1190fae27d076a2be/test/fixtures/es-modules/extensionless-cjs-module/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/62083/{{ revealButtonHref }}
Please reload this pagehttps://github.com/nodejs/node/pull/62083/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.