Skip to content

Commit

Permalink
fix(rspack): add required minimizer setting to the generated Nest rsp…
Browse files Browse the repository at this point in the history
…ack configuration
  • Loading branch information
lorenzodejong authored and Coly010 committed Oct 29, 2024
1 parent ff630a3 commit 45aaa7a
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 45aaa7a

Please sign in to comment.