nestjs/typescript-starter

Rebuilding the sources before start:prod doesn't make sense

xorik opened this issue · 3 comments

xorik commented

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The start:prod script rebuilds built sources each time (via the prestart:prod script)

Expected behavior

This script should run node without re-building

Minimal reproduction of the problem with instructions

  1. Install nest
  2. Run start:prod

What is the motivation / use case for changing the behavior?

Current implementation doesn't make sense. Both commands start and start:prod forces you to wait until sources are built.

In my opinion it's better to keep sources for the production mode, to save time.

I suggest moving rimraf dist command before build, and don't run build before start:prod.

Environment


Nest version: 6.1.1

 
For Tooling issues:
- Node version: v8.15.0  
- Platform: Mac 

Well, we honestly discussed this topic hundreds of times already. This really depends on the environment, and there are arguments behind both solutions. If there are more votes to remove rimraf, I'm fine with this change. Would you like to create a PR? We'd also have to create a corresponding PR for the schematics repo.

xorik commented

@kamilmysliwiec sure, the PR is quite simple to do, I can do it.

But it could broke some scripts for people, who use start:prod, because it automatically rebuilds.
Now an extra step will be required (run build command). I'm not sure how many people could be affected by this change.

@xorik it shouldn't affect existing applications (probably anyone is constantly rebasing to latest changes in the starter repo) so no worries about that :)