Skip to content

Commit 10a9178

Browse files
authoredSep 17, 2018
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.
1 parent 14c07f0 commit 10a9178

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎build/webpack.js

+5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ function optimizationConfig ({dir, dev, isServer, totalPages}) {
9999
chunks: 'all',
100100
minChunks: totalPages > 2 ? totalPages * 0.5 : 2
101101
}
102+
config.splitChunks.cacheGroups.react = {
103+
name: 'commons',
104+
chunks: 'all',
105+
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/
106+
}
102107

103108
return config
104109
}

0 commit comments

Comments
 (0)
Please sign in to comment.