Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the prestart:prod script remove the dist folder? #65

Closed
fvilers opened this issue Jan 11, 2019 · 5 comments
Closed

Why does the prestart:prod script remove the dist folder? #65

fvilers opened this issue Jan 11, 2019 · 5 comments

Comments

@fvilers
Copy link

fvilers commented Jan 11, 2019

Hi! I'm trying to deploy my first NestJS application and I may be doing something wrong. I can't find the documentation about building for production on the NestJS website.

From the available npm scripts, I've built the application using the build script and I'm trying to run it using the start:prod script. What bugs me is why do we have a prestart:prod script that removes the whole dist folder? The start:prod script can't start anything without it.

I suppose this is a bug and that the prestart:prod script is indeed a prebuild script. I'll gladly submit a PR if someone from the team confirms that bug.

@kamilmysliwiec
Copy link
Member

kamilmysliwiec commented Jan 15, 2019

"build": "tsc -p tsconfig.build.json",
"prestart:prod": "rimraf dist && npm run build"

prestart:prod removes dist and afterward, builds the entire project.

@fvilers
Copy link
Author

fvilers commented Jan 15, 2019

OK, thanks for the precision. It looks awkward to build the application on each startup, especially in a container environment. I usually build my application only once (on delivery) then start it from the dist folder.

@theill
Copy link

theill commented Aug 8, 2019

I agree with @fvilers - this should be a prebuild script instead as I see it.

@justinwilson-apollidon
Copy link

+1 I agree. The start of your application should assume it has already been built via your build system. For containerized environments, this is especially something that should be prebuild.

@kamilmysliwiec
Copy link
Member

We actually changed that already.

@nestjs nestjs locked as too heated and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants