#Ability to skip plugins in "nest start"

1 messages · Page 1 of 1 (latest)

queen stump
#

Starting nest without swagger plugin takes around 1.5s in my application, while with the plugin, it takes around 20s.
Using --watch, the rebuild takes 80ms without the plugin and 3s with it.

It would be a great dx improvement if we could run the application locally without the plugin enabled, as we won't need swagger docs for most our dev time.

If splitting start/build is not feasible, we could add an environment variable that would allow us to skip the plugin if we want to.

Running using monorepo + webpack + @nestjs/swagger (although which plugin used isn't the issue here).

https://github.com/nestjs/nest/issues/15275

vast crown
#

There's not a way to skip it in a specific command, but you could have a second nest-cli.json that doesn't have the plug-in and use that when you can start

queen stump
#

This is what I'm doing at this moment, but it feels hacky
I have a script to do that

/// create-nest-cli.mjs
import fs from 'node:fs';

const nestCliJson = fs.readFileSync('nest-cli.json', 'utf8');
const nestCliJsonParsed = JSON.parse(nestCliJson);

nestCliJsonParsed.compilerOptions.plugins = [];

fs.writeFileSync('nest-cli.local.json', JSON.stringify(nestCliJsonParsed, null, 2));

and then I run it with

node create-nest-cli.mjs && nest start --config nest-cli.local.json

But it wouldn't require me a script if I could just do something like:

NEST_SKIP_PLUGINS=@nestjs/swagger nest start
#

The improvements to run without the plugin is absurd

vast crown
#

Many people to my knowledge like having the plugin during development as well to ensure that the swagger they're generating is correct. It seems like Kamil isn't really interested in making the plugin skippable via env variables

queen stump
#

What about adding the possibility to extend a default nest-cli.json like eslint or tsconfig do?

nest-cli.json

{
  ...
}

nest-cli.local.json

{
  "extends": "./nest-cli.json",
  "compilerOptions": {
    "plugins": []
  }
  ...
}
oblique marsh
#

it's better to stick with the 2 config files approach, one with plugins and the other without it