Skip to content

module: runtime deprecate require.extensions #58642

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

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

Conversation

marco-ippolito
Copy link
Member

I'm opening this as draft PR to discuss if we should do runtime deprecate require.extensions.
It has been deprecated since v0.10.6.
This might have a large impact.
It's causing some issues for type stripping nodejs/typescript#37

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jun 9, 2025

Review requested:

  • @nodejs/loaders
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Jun 9, 2025
@marco-ippolito marco-ippolito added deprecations Issues and PRs related to deprecations. semver-major PRs that contain breaking changes and should be released in the next major version. labels Jun 9, 2025
@targos
Copy link
Member

targos commented Jun 9, 2025

We should run citgm on this.

@marco-ippolito marco-ippolito added the needs-citgm PRs that need a CITGM CI run. label Jun 9, 2025
@@ -878,7 +878,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Documentation-only
Type: Runtime

The [`require.extensions`][] property is deprecated.
Copy link
Member

@legendecas legendecas Jun 9, 2025

Choose a reason for hiding this comment

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

I think an alternative, like module.register or module.registerHooks, should be recommended, and be stable, before runtime deprecating this.

Copy link
Member

Choose a reason for hiding this comment

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

registerHooks, not register. The latter should go away once the former is ready. And registerHooks is a more appropriate replacement for extensions as both are sync.

Copy link
Member Author

@marco-ippolito marco-ippolito Jun 9, 2025

Choose a reason for hiding this comment

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

it would actually need an api that returns all the registered hooks + registerHooks

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.

I don't think we can do this before registerHooks() is stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecations Issues and PRs related to deprecations. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. needs-citgm PRs that need a CITGM CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants