Skip to content
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

remove node: prefixed modules from builtinModules #57066

Open
huseeiin opened this issue Feb 15, 2025 · 4 comments
Open

remove node: prefixed modules from builtinModules #57066

huseeiin opened this issue Feb 15, 2025 · 4 comments

Comments

@huseeiin
Copy link

huseeiin commented Feb 15, 2025

Version

23.6.0

Platform


Subsystem

No response

What steps will reproduce the bug?

import { builtinModules } from "node:module";
console.log(builtinModules.filter((r) => r.startsWith("node:")).length);

How often does it reproduce? Is there a required condition?

every time

What is the expected behavior? Why is that the expected behavior?

0

What do you see instead?

4

Additional information

builtinModules docs say Note: the list doesn't contain prefix-only modules like node:test.

@aduh95
Copy link
Contributor

aduh95 commented Feb 15, 2025

builtinModules docs say Note: the list doesn't contain prefix-only modules like node:test.

It does not, not on the versions that include prefix-only modules in builtinModules: https://nodejs.org/api/module.html#modulebuiltinmodules

Why are you saying the expected behavior would be 0? Could share your use-case and explain what you don't like about this change?

@AugustinMauroy
Copy link
Member

AugustinMauroy commented Feb 15, 2025

@huseeiin are you asking to have a way to list all builtin module that require node: prefix (with a js code)

@ljharb
Copy link
Member

ljharb commented Feb 15, 2025

These were added intentionally in #56185.

@dario-piotrowicz
Copy link
Contributor

@huseeiin are you asking to have a way to list all builtin module that require node: prefix (with a js code)

That can be easily done via:

require('node:module').builtinModules.filter(m => m.startsWith('node:'))

right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants