From 70e7dbcf44168988966d8b6083ba5665d5bbc6c0 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Wed, 5 Jun 2024 12:51:27 +0530 Subject: [PATCH] docs(guides): clarify SplitChunksPlugin behavior (#7275) --- src/content/guides/code-splitting.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/guides/code-splitting.mdx b/src/content/guides/code-splitting.mdx index 176ee90d708f..7cbefa6a3ddb 100644 --- a/src/content/guides/code-splitting.mdx +++ b/src/content/guides/code-splitting.mdx @@ -236,7 +236,9 @@ The [`SplitChunksPlugin`](/plugins/split-chunks-plugin/) allows us to extract co }; ``` -With the [`optimization.splitChunks`](/plugins/split-chunks-plugin/#optimizationsplitchunks) configuration option in place, we should now see the duplicate dependency removed from our `index.bundle.js` and `another.bundle.js`. The plugin should notice that we've separated `lodash` out to a separate chunk and remove the dead weight from our main bundle. Let's do an `npm run build` to see if it worked: +With the [`optimization.splitChunks`](/plugins/split-chunks-plugin/#optimizationsplitchunks) configuration option in place, we should now see the duplicate dependency removed from our `index.bundle.js` and `another.bundle.js`. The plugin should notice that we've separated `lodash` out to a separate chunk and remove the dead weight from our main bundle. However, it's important to note that common dependencies are only extracted into a separate chunk if they meet the [size thresholds](/plugins/split-chunks-plugin/#splitchunksminsize) specified by webpack. + +Let's do an `npm run build` to see if it worked: ```bash ...