nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

Use `ts-node-dev` to instead current development script: `npm run start:dev` #2993

Closed wxs77577 closed 5 years ago

wxs77577 commented 5 years ago

Feature Request

Is your feature request related to a problem? Please describe.

  1. Yes. use npm run start:dev to build all .ts files to .js files, it's different from server deployed script: npm start (it runs *.ts directly)
  2. npm run start:dev is slow.

Describe the solution you'd like

Add a script in package.json like 'serve`

"serve": "ts-node-dev src/main.ts",

Teachability, Documentation, Adoption, Migration Strategy

use npm run serve instead npm run start:dev (or not)

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

ts-node-dev is becoming more and more popular.

kamilmysliwiec commented 5 years ago

We do plan to get rid of both soon https://github.com/nestjs/typescript-starter/pull/151

wxs77577 commented 5 years ago

But the problem is still exists: It's different between built *.js files and raw *.ts files. Sometimes, it's all fine during my local development, but when I push codes to server and reload the pm2 process (which just run npm start), it crashed, just because of a typing define problem, but there is no problem when I use npm run start:dev(because it compile ts files to plain js files), so, would you think that is a problem ?

marcus-sa commented 5 years ago

@wxs77577 I don't think this have anything to do with Nest at all. ts-node will mitigate all TS typechecking errors, so you can't really rely on that when deploying to a production server. You should be looking into a proper CI/CD pipeline using unit testing, linting, e2e testing and deployment.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.