René's URL Explorer Experiment


Title: Always run async loader hooks synchronously from the non-loader thread · Issue #59666 · nodejs/node · GitHub

Open Graph Title: Always run async loader hooks synchronously from the non-loader thread · Issue #59666 · nodejs/node

X Title: Always run async loader hooks synchronously from the non-loader thread · Issue #59666 · nodejs/node

Description: This was an idea discussed in the loaders group a few times in the past as well as in the last collaboration summit. Opening an issue to track it properly. This is related to #55782 and will allow us to Eliminate the races in ESM cache h...

Open Graph Description: This was an idea discussed in the loaders group a few times in the past as well as in the last collaboration summit. Opening an issue to track it properly. This is related to #55782 and will allow ...

X Description: This was an idea discussed in the loaders group a few times in the past as well as in the last collaboration summit. Opening an issue to track it properly. This is related to #55782 and will allow ...

Opengraph URL: https://github.com/nodejs/node/issues/59666

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Always run async loader hooks synchronously from the non-loader thread","articleBody":"This was an idea discussed in the loaders group a few times in the past as well as in the last collaboration summit. Opening an issue to track it properly.\n\nThis is related to https://github.com/nodejs/node/issues/55782 and will allow us to\n\n1. Eliminate the races in ESM cache handling when `require(esm)` needs the linking to be synchronous but `import esm` may populate an asynchronous linking job in the cache. There were multiple band-aids applied to work around this, like https://github.com/nodejs/node/pull/59519 and https://github.com/nodejs/node/pull/57187, but to fully eliminate the races, this would be necessary to finish https://github.com/nodejs/node/issues/55782\n2. Go back to using the authentic `require()` in imported CJS instead of re-inventing a separate `require()` and eliminate its quirks, which currently includes\n    1. The re-invented `require` lacks a lot of properties like `require.cache`, which is a documented caveat https://nodejs.org/api/module.html#caveat-in-the-asynchronous-load-hook - this means a lot of code may not be able to load when the async customization hooks are registered, as they directly rely on these properties.\n    2. The source code for CJS ended up being loaded twice https://github.com/nodejs/node/blob/0fd1ecded6476378b207cacc8fb4e2f1698830c6/lib/internal/modules/esm/load.js#L97-L99\n    3. As a side-effect of the previous quirk, when the module format is CJS, the user hook can't assume the `source` is available and need to cope with `source` being `null`, usually by reading directly from the file system (not necessarily correct), like what's [being done in import-in-the-middle](https://github.com/nodejs/import-in-the-middle/blob/53a33a9b07799bff815864089a0c072d223df47b/lib/get-exports.js#L100), see https://github.com/nodejs/node/issues/57327#issuecomment-2701382020\n    4. Also as a side-effect, if they don't override the nullish value by supplementing source code that they obtain through other means, the `require` in imported CommonJS won't trigger the hooks.\n    5. The `resolve` hook gets `\"import\"` in its conditions array for `require()`, instead of `\"require\"` (because it's using ESM resolution). This can lead to wrong modules being loaded when loading packages that split the conditional exports.\n    6. The `resolve` hook gets the full URL, not the specifier passed to `require()`\n    7. Invoking the sync hooks twice for CJS, one from the re-invented require, one from the `Module._load` invocation in the evaluation step.\n\nRefs: https://github.com/nodejs/node/issues/57327\nRefs: https://github.com/nodejs/node/issues/55808\nRefs: https://github.com/nodejs/node/issues/52697\nRefs: https://github.com/nodejs/node/issues/56241\nRefs: https://github.com/nodejs/node/issues/55782\n\ncc @nodejs/loaders ","author":{"url":"https://github.com/joyeecheung","@type":"Person","name":"joyeecheung"},"datePublished":"2025-08-28T13:18:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/59666/node/issues/59666"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:dfa61071-2d8f-c363-e1e0-74c19867a52c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id80EC:3AAB0D:AA25C:E5E3D:6969A375
html-safe-nonce8b9d7ecc6c29855c0d779db91c5a1a8931384bbf023638d72104e43c5066d226
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEVDOjNBQUIwRDpBQTI1QzpFNUUzRDo2OTY5QTM3NSIsInZpc2l0b3JfaWQiOiIxMzI0MjgzOTQxMjA3MjUzODc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac76f8b58950814479b9d9f68696c9f766993fdf2e5f8c16862d2e2a1b865311ae
hovercard-subject-tagissue:3363305726
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/59666/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b6b93f613accd61271d64730629654297c6481ab7a384335d373b3f6dc7c261b/nodejs/node/issues/59666
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b6b93f613accd61271d64730629654297c6481ab7a384335d373b3f6dc7c261b/nodejs/node/issues/59666
og:image:altThis was an idea discussed in the loaders group a few times in the past as well as in the last collaboration summit. Opening an issue to track it properly. This is related to #55782 and will allow ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejoyeecheung
hostnamegithub.com
expected-hostnamegithub.com
None24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release124667f43168afb6c9c03b7c02eb5b1d2e1be3d9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/59666#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F59666
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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%2Fissues%2F59666
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/59666
Reloadhttps://github.com/nodejs/node/issues/59666
Reloadhttps://github.com/nodejs/node/issues/59666
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/59666
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 34.4k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 115k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.7k https://github.com/nodejs/node/issues
Pull requests 697 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects 3 https://github.com/nodejs/node/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/nodejs/node/security
Please reload this pagehttps://github.com/nodejs/node/issues/59666
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 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/59666
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/59666
#60380https://github.com/nodejs/node/pull/60380
Always run async loader hooks synchronously from the non-loader threadhttps://github.com/nodejs/node/issues/59666#top
#60380https://github.com/nodejs/node/pull/60380
loadersIssues and PRs related to ES module loadershttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22loaders%22
https://github.com/joyeecheung
https://github.com/joyeecheung
joyeecheunghttps://github.com/joyeecheung
on Aug 28, 2025https://github.com/nodejs/node/issues/59666#issue-3363305726
#55782https://github.com/nodejs/node/issues/55782
esm: link modules synchronously when no async loader hooks are used #59519https://github.com/nodejs/node/pull/59519
module: handle cached linked async jobs in require(esm) #57187https://github.com/nodejs/node/pull/57187
Tracking Issue: Syncify the ESM Loader #55782https://github.com/nodejs/node/issues/55782
https://nodejs.org/api/module.html#caveat-in-the-asynchronous-load-hookhttps://nodejs.org/api/module.html#caveat-in-the-asynchronous-load-hook
node/lib/internal/modules/esm/load.jshttps://github.com/nodejs/node/blob/0fd1ecded6476378b207cacc8fb4e2f1698830c6/lib/internal/modules/esm/load.js#L97-L99
0fd1ecdhttps://github.com/nodejs/node/commit/0fd1ecded6476378b207cacc8fb4e2f1698830c6
being done in import-in-the-middlehttps://github.com/nodejs/import-in-the-middle/blob/53a33a9b07799bff815864089a0c072d223df47b/lib/get-exports.js#L100
ERR_INVALID_RETURN_PROPERTY_VALUE when using module.register and module.registerHooks #57327 (comment)https://github.com/nodejs/node/issues/57327#issuecomment-2701382020
#57327https://github.com/nodejs/node/issues/57327
#55808https://github.com/nodejs/node/issues/55808
#52697https://github.com/nodejs/node/issues/52697
#56241https://github.com/nodejs/node/issues/56241
#55782https://github.com/nodejs/node/issues/55782
loadersIssues and PRs related to ES module loadershttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22loaders%22
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.