Skip to content

doc: note importAttributes is undefined for require - #67211

Open
lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:doc/module-hooks-import-attributes
Open

lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:doc/module-hooks-import-attributes

Conversation

@lazerg

@lazerg lazerg commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

The synchronous resolve and load hooks document context.importAttributes as an {Object}, but the CommonJS loader passes undefined for everything it loads, including require() calls and a CommonJS entry point. A hook that reads context.importAttributes.type throws on the first CommonJS dependency. This marks it as {Object|undefined} and says when it is undefined.

Fixes: #67209

Signed-off-by: lazerg <lazerg2@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. module Issues and PRs related to the module subsystem. labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

Signed-off-by: lazerg <lazerg2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:community-flagged doc Issues and PRs related to Node.js documentation. module Issues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module hooks' context.importAttributes is undefined for require(), but documented as an <Object>

2 participants