SplitChunksPlugin:Repeated packaging of synchronous dependencies of multi-entry asynchronously loaded modules #20049
Unanswered
danhuang250
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
You can use - https://webpack.js.org/plugins/split-chunks-plugin/#splitchunkscachegroupscachegroupreuseexistingchunk, only one chunk will be generated |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
Project structure: My project has two entry points, main and preview. The main entry point asynchronously imports the a.js file, and the preview entry point asynchronously imports the b.js file. Both a and b files will synchronously import the allSdk module.
Current packaging result: The allSdk module will be generated twice, but allSdk will not be loaded in the HTML of the two entry documents.
Change configuration: Add name: 'allSdk' to splitChunks.allSdk. Although allSdk will only be packaged once, allSdk will be loaded in the HTML of both documents.
How should I configure to achieve packaging allSdk only once, and ensure this module does not directly load HTML documentation??
Beta Was this translation helpful? Give feedback.
All reactions