Skip to content

Instantly share code, notes, and snippets.

@fidaay
Forked from anderjs/config-override.js
Created May 31, 2023 03:38
Show Gist options
  • Save fidaay/5bd841ced6a787239a71ebca07ea3080 to your computer and use it in GitHub Desktop.
Save fidaay/5bd841ced6a787239a71ebca07ea3080 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