Skip to content

Instantly share code, notes, and snippets.

@ferdaber
Created May 3, 2019 14:13
Show Gist options
  • Select an option

  • Save ferdaber/019e27a4cbde113f667d2ca83411fc66 to your computer and use it in GitHub Desktop.

Select an option

Save ferdaber/019e27a4cbde113f667d2ca83411fc66 to your computer and use it in GitHub Desktop.
optimization: {
splitChunks: {
chunks: 'async',
minSize: 30000,
maxSize: 0,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
automaticNameDelimiter: '~',
name: true,
cacheGroups: {
// this splits off modules from the initial entry point that are from node_modules
// into their own cache group
'vendors-initial': {
chunks: 'initial',
test: /[\\/]node_modules[\\/]/,
name: 'vendors-initial',
priority: -10,
},
// this splits off modules from async entry points that are from node_modules
// into their own cache group, with higher priority since they usually don't change as much
vendors: {
chunks: 'async',
test: /[\\/]node_modules[\\/]/,
priority: -10,
},
// all others go to this cache group
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
// between the last two cache groups we use the settings above to figure out what to do
},
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment