Skip to content

Commit

Permalink
fix: add required minimizer setting to the generated Nest rspack conf…
Browse files Browse the repository at this point in the history
…iguration
  • Loading branch information
lorenzodejong authored Oct 25, 2024
1 parent ff630a3 commit d16b183
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/rspack/src/utils/generator-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,27 @@ function createConfig(
} else if (options.framework === 'nest') {
return `
const { composePlugins, withNx } = require('@nx/rspack');
const rspack = require('@rspack/core');
config.optimization = {
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin({
minimizerOptions: {
// We need to disable mangling and compression for class names and function names for Nest.js to work properly
// The execution context class returns a reference to the class/handler function, which is for example used for applying metadata using decorators
// https://docs.nestjs.com/fundamentals/execution-context#executioncontext-class
compress: {
keep_classnames: true,
keep_fnames: true,
},
mangle: {
keep_classnames: true,
keep_fnames: true,
},
},
}),
],
};
module.exports = composePlugins(withNx(), (config) => {
return config;
Expand Down

0 comments on commit d16b183

Please sign in to comment.