You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dynamic-imported script is included in commons chunk.
Looking at configuration for commons chunk in webpack.config.js.
commons: {
name: `commons`,
// if a chunk is used on all components we put it in commons
minChunks: componentsCount,
priority: 20
},
Now above componentsCount is 1, so all dynamic components are included in commons chunk.
I think componentsCount should be at least 2. Another way is to set test function for commons to include all files from node_modules except those in frameworks chunk.
By the way, test function uses module.identifier() method. Is module.resource field better?
Description
The dynamic-imported script is included in
commons
chunk.Looking at configuration for
commons
chunk in webpack.config.js.Now above
componentsCount
is 1, so all dynamic components are included in commons chunk.I think componentsCount should be at least 2. Another way is to set
test
function for commons to include all files from node_modules except those in frameworks chunk.By the way,
test
function uses module.identifier() method. Is module.resource field better?Steps to reproduce
commons
chunk instead of a separate chunk file.Expected result
This dynamic-imported script should be a separate chunk
Actual result
It is included in
commons
chunk now.Environment
System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 80.0.3987.149
Safari: 13.0.5
npmPackages:
gatsby: ^2.20.10 => 2.20.10
gatsby-link: ^2.2.27 => 2.3.1
gatsby-plugin-algolia: ^0.5.0 => 0.5.0
gatsby-plugin-gtag: ^1.0.12 => 1.0.13
gatsby-plugin-layout: ^1.1.18 => 1.2.1
gatsby-plugin-mdx: ^1.0.61 => 1.1.4
gatsby-plugin-no-sourcemaps: ^2.1.2 => 2.2.0
gatsby-plugin-offline: ^3.0.29 => 3.1.2
gatsby-plugin-postcss: ^2.1.20 => 2.2.1
gatsby-plugin-react-helmet: ^3.1.18 => 3.2.1
gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
gatsby-plugin-remove-trailing-slashes: ^2.1.17 => 2.2.1
gatsby-plugin-sitemap: ^2.2.24 => 2.3.1
gatsby-remark-attr: 0.0.3 => 0.0.3
gatsby-remark-copy-linked-files: ^2.1.33 => 2.2.1
gatsby-source-filesystem: ^2.1.42 => 2.2.2
gatsby-transformer-remark: ^2.6.42 => 2.7.1
The text was updated successfully, but these errors were encountered: