Skip to content

Instantly share code, notes, and snippets.

@yifanwww
Last active December 7, 2024 17:50
Show Gist options
  • Save yifanwww/0e843ee0d5ba66a2dfd34fe3300c66bf to your computer and use it in GitHub Desktop.
Save yifanwww/0e843ee0d5ba66a2dfd34fe3300c66bf to your computer and use it in GitHub Desktop.
nestjs cli webpack build issues
  1. nest new test
  2. add/install class-validator, class-transformer and @nestjs/mapped-types
  3. update nest-cli.json to switch builder to webpack (according to https://docs.nestjs.com/cli/monorepo#global-compiler-options)
  4. create webpack.config.js with following contents (according to https://docs.nestjs.com/cli/monorepo#webpack-options):
module.exports = {
  externals: [],
};
  1. add the following code to src/main.ts
import { IntersectionType } from '@nestjs/mapped-types';

class DtoA {}

class DtoB {}

class DtoC extends IntersectionType(DtoA, DtoB) {}

DtoC;
  1. npm run build produces 1 error

Module not found: Error: Can't resolve 'class-transformer/storage' in ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment