Home > Blockchain >  NestJS: only use webpack for production build
NestJS: only use webpack for production build

Time:07-11

When using NestJS CLI to build apps, it uses WebPack by default - which can be changed in nest-cli.json.

However, WebPack takes time, and most build are for development purposes, on developers' laptops. Can I set Nest CLI to only use WebPack when building for production?

CodePudding user response:

The easiest way to do this is by passing --tsc and --webpack along with nest start and nest build commands like this:

nest start --tsc // start with typescript
nest start --webpack // start with webpack

If your configurations are complicated then you can create two separate nest-cli.json config file and use --config option to choose each of them depending on your circumstances whether that you are in dev mode or production:

nest start --config [path]
  • Related