Skip to content

module: run require.resolve through module.registerHooks()#62028

Open
joyeecheung wants to merge 1 commit intonodejs:mainfrom
joyeecheung:fix-require-resolve
Open

module: run require.resolve through module.registerHooks()#62028
joyeecheung wants to merge 1 commit intonodejs:mainfrom
joyeecheung:fix-require-resolve

Conversation

@joyeecheung
Copy link
Member

Previously, require.resolve() called Module._resolveFilename() directly, bypassing any resolve hooks registered via module.registerHooks(). This patch fixes that.

Previously, require.resolve() called Module._resolveFilename() directly,
bypassing any resolve hooks registered via module.registerHooks(). This
patch fixes that.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Feb 27, 2026
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.73%. Comparing base (76ba280) to head (5e065ef).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62028      +/-   ##
==========================================
- Coverage   89.73%   89.73%   -0.01%     
==========================================
  Files         676      676              
  Lines      206069   206080      +11     
  Branches    39515    39517       +2     
==========================================
+ Hits       184915   184924       +9     
- Misses      13305    13307       +2     
  Partials     7849     7849              
Files with missing lines Coverage Δ
lib/internal/modules/cjs/loader.js 98.46% <100.00%> (+0.09%) ⬆️
lib/internal/modules/esm/loader.js 98.77% <100.00%> (+<0.01%) ⬆️
lib/internal/modules/esm/translators.js 97.64% <100.00%> (+<0.01%) ⬆️
lib/internal/modules/helpers.js 98.68% <100.00%> (+0.19%) ⬆️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

esm Issues and PRs related to the ECMAScript Modules implementation. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants