webpack
webpack copied to clipboard
fix: using chunkGraph from hook context
Use chunkGraph from hook context instead of compilation
Summary
🤖 Generated by Copilot at cc6d740
This pull request refactors and improves the runtime module system for webpack. It adds support for new features such as container references, CSS modules, WebAssembly compilation, and chunk prefetching and preloading. It also updates the plugin API to use the new chunkGraph
argument and the RuntimeRequirementsContext
type. It modifies various plugins and hooks to use the new runtime modules and runtime requirement hooks. It removes some redundant or deprecated code and adds type annotations for better type checking and documentation.
Details
🤖 Generated by Copilot at cc6d740
- Refactor
compilation
hooks to usechunkGraph
as an argument instead of accessing the deprecatedcompilation.chunkGraph
property (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link) - Add
context
argument toadditionalTreeRuntimeRequirements
hook to accesschunkGraph
and other properties (link, link, link, link, link, link, link, link, link) - Add various runtime modules to handle different runtime requirements, such as
hot module replacement
,chunk loading
,wasm compilation
,shared modules
, etc. (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link) - Import
RuntimeRequirementsContext
type definition fromlib/APIPlugin.js
in files that use it (link, link, link, link, link, link)
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: JSerFeng / name: Fy (cc6d740b22d001c65bd021b3038753979dd71c3c)
For maintainers only:
- [ ] This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
- [ ] This needs to be backported to webpack 4 (issue will be created when merged)
There is a replacement of compilation.chunkGraph in compilation.executeModule, code is here, I assume it's because plugins might use the chunkGraph from compilation, causing some logic can't be applied to the chunkGraph that compilation.executeModule created, so here is a replacement for this.
It's not actually necessary tho, just found that there are many plugins do that not use chunkGraph from hook parameters.
It's fine to ignore this PR ^, If I think it wrong, please let me know