Skip to content

Commit

Permalink
Enable compression plugin with deleteOriginalAssets: true
Browse files Browse the repository at this point in the history
  • Loading branch information
mman committed May 22, 2024
1 parent 61b91d2 commit 6ba1e3c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ForkTsCheckerWebpackPlugin =
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");

const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');

Expand Down Expand Up @@ -419,7 +420,7 @@ module.exports = function (webpackEnv) {
},
],
],

plugins: [
isEnvDevelopment &&
shouldUseReactRefresh &&
Expand Down Expand Up @@ -453,7 +454,7 @@ module.exports = function (webpackEnv) {
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,

// Babel sourcemaps are needed for debugging into node_modules
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
Expand Down Expand Up @@ -747,6 +748,11 @@ module.exports = function (webpackEnv) {
},
},
}),
new CompressionPlugin({
threshold: 0,
deleteOriginalAssets: true,
})

].filter(Boolean),
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
Expand Down

0 comments on commit 6ba1e3c

Please sign in to comment.