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
feat: add support for additional node.js builtin modules #12181
Conversation
For maintainers only:
|
@dnalborczyk Can you accept CLA, and let's add all |
@alexander-akait I accepted the CLA, although it seemed to be somewhat buggy around the time I created the PR. it seems @sokra fixed it with closing + reopening.
webpack/lib/node/NodeTargetPlugin.js Line 26 in 943c60b
if you know about any additional missing paths I can add them in this PR as well, otherwise I think they can be added in subsequent PRs if an issue should arise. |
@dnalborczyk yep, but let's fix all of them in the one PR, need to add:
Also I found Node.js modules can be used |
ef67f70
to
56f42f1
Compare
Let's fix lint problems |
I also added wasi, which seems to cause a spell checking problem. I'll fix it. Not sure if there's a pattern used for the webpack project yet? it seems to work if applied anywhere in the code, e.g. const a = [
...
"wasi", // cSpell:ignore wasi
...
] or better on top of the file? or do we have a global words file? |
@dnalborczyk Thanks for your update. I labeled the Pull Request so reviewers will review it again. @alexander-akait Please review the new changes. |
in the interim I added the |
interesting, I didn't know it found its way into node.js already. https://github.com/tc39/proposal-built-in-modules#namespace I'll have a look into this (and possible future PR). |
Thanks |
I think support should be added once I suppose eventually (if the need arises), |
I think it is not related to output format
webpack suppots @sokra Should we add this as plugin? |
I gave it a spin, it only works with ES6 modules. when run in // works
import { readFile } from 'node:fs' commonjs: // does not
const { readFile } = require('node:fs') when webpack bundles to anything other than esm (which it does not support yet), it won't work. |
@dnalborczyk webpack accepts es module syntax, so developer can use |
if I'm not mistaken, currently, webpack transpiles (bundles) related: #2933 in order to have it working you'd need to bundle |
I mean webpack can resolve |
the prefixed |
@dnalborczyk can you open an issue issue? |
What kind of change does this PR introduce?
feature, node.js builtin support for "timers/promises"feature, adds support for dns/promises, stream/promises, timers/promises, wasi
https://nodejs.org/api/timers.html#timers_timers_promises_api
Did you add tests for your changes?
no.
Does this PR introduce a breaking change?
no, additive.
What needs to be documented once your changes are merged?
n/a