Skip to content

Instantly share code, notes, and snippets.

@anderjs
Last active May 31, 2023 03:38
Show Gist options
  • Save anderjs/078f3494a01a323d0411a765fe7ed18e to your computer and use it in GitHub Desktop.
Save anderjs/078f3494a01a323d0411a765fe7ed18e to your computer and use it in GitHub Desktop.
Cache Busting CRA with react-app-rewired
const path = require('path')
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = function (config) {
return merge(config, {
plugins: [
new CleanWebpackPlugin(),
],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'static/js/[name].[hash].js',
},
optimization: {
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'main',
chunks: 'all'
}
}
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment