Last active
May 31, 2023 03:38
-
-
Save anderjs/078f3494a01a323d0411a765fe7ed18e to your computer and use it in GitHub Desktop.
Cache Busting CRA with react-app-rewired
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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