Unverified Commit 10a9178e authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Make sure react always ends up in the commons bundle (#5192)

Fixes an edge case where some library imports react-dom by itself, like react-spring.
parent 14c07f05
...@@ -99,6 +99,11 @@ function optimizationConfig ({dir, dev, isServer, totalPages}) { ...@@ -99,6 +99,11 @@ function optimizationConfig ({dir, dev, isServer, totalPages}) {
chunks: 'all', chunks: 'all',
minChunks: totalPages > 2 ? totalPages * 0.5 : 2 minChunks: totalPages > 2 ? totalPages * 0.5 : 2
} }
config.splitChunks.cacheGroups.react = {
name: 'commons',
chunks: 'all',
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/
}
return config return config
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment