-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat: improve rendering node built-in module #20255
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
base: main
Are you sure you want to change the base?
Conversation
|
| expect(content).toContain("require(\"fs\");"); | ||
| } else if (/(bundle1\.mjs|bundle3\.mjs|bundle6\.mjs)$/.test(__filename)) { | ||
| expect(content).toContain("from \"url\""); | ||
| expect(content).toContain("from \"module\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer generate import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module; __WEBPACK_EXTERNAL_createRequire("fs")" in this PR.
|
This PR is packaged and the instant preview is available (e71315e). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@e71315e
yarn add -D webpack@https://pkg.pr.new/webpack@e71315e
pnpm add -D webpack@https://pkg.pr.new/webpack@e71315e |
CodSpeed Performance ReportMerging #20255 will not alter performanceComparing Summary
|
| @@ -0,0 +1,10 @@ | |||
| import fs from "fs"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test case where we import all Node.js modules (just take them from NodeTargetPlugin and generate a module with require's) just to ensure we can replace require on import for all Node.js modules (It seems like there was a bug with this once, but I could be wrong, let's check it out.)
cce0ecf to
356f9cb
Compare
356f9cb to
e71315e
Compare
Summary
What kind of change does this PR introduce?
Improve rendering built-in module when target to node and enable module output.
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
No