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
improvements to ESM support, module
library, import
chunk loading, module
externals
#13622
Conversation
For maintainers only:
|
b6b94a7
to
a43edfd
Compare
add test cases for `experiments.outputModule`
a43edfd
to
4da99d8
Compare
D( | ||
output, | ||
"hotUpdateChunkFilename", | ||
`[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` |
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.
Maybe we can read package.json
here and use js
when "type": "module"
(same for filename
)?
module
library, import
chunk loadingmodule
library, import
chunk loading, module
externals
… externals for `module` externals, fallback to `import()` when not in module mode
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
I've created an issue to document this in webpack/webpack.js.org. |
@@ -0,0 +1,16 @@ | |||
module.exports = { |
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.
I cannot let my webpack 5.46 emit import(...)
with this config. Is this feature released?
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.
Oh sorry I forgot to export config file
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
output.library.type: "module"
is now experimentally supportedoutput.chunkLoading: "import"
usesimport()
to load chunksoutput.chunkFormat: "module"
uses ESM exports to expose chunk dataexperiments.outputModule
will now useoutput.chunkFormat: "module", output.chunkLoading: "import"
externalsType: "module"
generates nowimport * as X from "..."
(in a module) orimport("...")
(in a script)externalsType: "node-commonjs"
generatesimport { createRequire } from "module"
when in a moduleexternalsPresets
usenode-commonjs
now when node.js related