-
-
Save fidaay/5bd841ced6a787239a71ebca07ea3080 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