Skip to content

module: fix conditions override in synchronous resolve hooks #59011

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joyeecheung
Copy link
Member

  1. Make sure that the conditions are converted into arrays when being passed into user hooks.
  2. Pass the conditions from user hooks into the ESM resolution so that it takes effect.

Fixes: #59003

@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 Jul 9, 2025
1. Make sure that the conditions are converted into arrays when
  being passed into user hooks.
2. Pass the conditions from user hooks into the ESM resolution
  so that it takes effect.
@joyeecheung joyeecheung force-pushed the fix-conditions-cjs branch from 410d2b6 to fbe0278 Compare July 9, 2025 15:38
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.07%. Comparing base (9ab9763) to head (fbe0278).
Report is 20 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #59011    +/-   ##
========================================
  Coverage   90.06%   90.07%            
========================================
  Files         640      641     +1     
  Lines      188523   188870   +347     
  Branches    36982    37054    +72     
========================================
+ Hits       169796   170127   +331     
+ Misses      11449    11448     -1     
- Partials     7278     7295    +17     
Files with missing lines Coverage Δ
lib/internal/modules/cjs/loader.js 97.72% <100.00%> (-0.14%) ⬇️
lib/internal/modules/esm/loader.js 96.33% <100.00%> (-0.03%) ⬇️
lib/internal/modules/helpers.js 98.87% <100.00%> (+0.49%) ⬆️

... and 50 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.

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 9, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 9, 2025
@nodejs-github-bot
Copy link
Collaborator

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.

node:module registerHooks resolve context.conditions is Array or Set
3 participants