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

Implement ability to use "node:" prefixes for Node.js core modules #18277

Closed
krutoo opened this issue Apr 3, 2024 · 1 comment · Fixed by #18316
Closed

Implement ability to use "node:" prefixes for Node.js core modules #18277

krutoo opened this issue Apr 3, 2024 · 1 comment · Fixed by #18316

Comments

@krutoo
Copy link

krutoo commented Apr 3, 2024

Feature request

What is the expected behavior?

Based on this discussion:
#18265

What is motivation or use case for adding/changing the behavior?

In order for the bundle to be used in runtimes that support Node.js core modules (for example Deno), we need to implement an option that would force the internal webpack code to use node: prefixes

How should this be implemented in your opinion?

As @alexander-akait says here:
#18265 (reply in thread)

we need to implement nodePrefixForCoreModules here https://github.com/webpack/webpack/blob/main/lib/config/browserslistTargetHandler.js#L336, put version there, than implement supportsModePrefixForCoreModules() {} in RuntimeTemplate.js and use it everywhere we generate external exports for core modules

Are you willing to work on this yourself?
no

@krutoo krutoo changed the title Implement Node.js prefixes for core modules importing Implement ability to use "node:" prefixes for Node.js core modules Apr 3, 2024
@alexander-akait
Copy link
Member

For me:

Version	Changes
v16.0.0, v14.18.0	
Added `node`: import support to require(...).

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

Successfully merging a pull request may close this issue.

2 participants