webpack: LimitChunkCountPlugin max chunks not working for dynamic import
Bug report
What is the current behavior? When use LimitChunkCountPlugin with dynamic import for multi entry, webpack will generate chunks even set maxChunks = 1.
If the current behavior is a bug, please provide the steps to reproduce.
The repo can show the current behavior, just as the image shown below.
What is the expected behavior? I think webpack should only generate the entry chunk with LimitChunkCountPlugin for each entry and prevent any additional chunks.
Other relevant information: webpack version: 4.44.1 Node.js version: v12.18.2 Operating System: MacBook-Pro
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 26 (13 by maintainers)
Still valid
@mohsinulhaq you can set this option to
eager
if you just want to get rid of dynamic import chunks.@hoang-dao try this:
@vankop the issue can still be reproducible following the posted repo (https://github.com/LLGZONE/limitchunkplugin-demo) even with updated dependencies
In my case, my project is a monorepo which contains many typescript serverless functions, I follow the entry descriptor and set
chunkLoading: false
as a workaround to build a single bundle for every entry point https://webpack.js.org/configuration/entry-context/#entry-descriptor.Refer from the posted repo, this is my updated config: // webpack.config.js
Hope it can help!