Skip to content

Commit

Permalink
Keep classnames in minified files
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofstuff committed Sep 11, 2024
1 parent 5bd23c5 commit 5922dd9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
// Both these packages are expected to be included by react-app-rewired
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = function override(config, env) {
if (env === 'production') {
config.optimization.minimizer = config.optimization.minimizer.map((plugin) => {
if (plugin instanceof TerserPlugin) {
return new TerserPlugin({
test: plugin.options.test,
terserOptions: {
keep_classnames: true,
},
});
}

return plugin;
});
}

module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: false, // require.resolve("crypto-browserify") can be polyfilled here if needed
Expand Down

0 comments on commit 5922dd9

Please sign in to comment.