seanpmaxwell / express-generator-typescript

Create a new express app similar to express-generator but with TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

--watch instead of nodemon

bagdasaryanem opened this issue · comments

Hi, I'm wondering if it's possible to update the project to use the native ts --watch instead of the Nodemon package. The --watch option is available after Node 18.11.x?

Hmm, could you show me an example of what the command would look like? Keep in mind the current nodemon command uses ts-node.

"start": "node --watch --loader ts-node/esm src/index.ts"

I use this command in my Express app and it works quite well.

So when I run that command I'm getting this error:

(node:53297) ExperimentalWarning: Watch mode is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:53298) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Cannot find module '@src/declarations/major/EnvVars'

So two things: 1 I think your command is missing the setup for tsconfig paths, and 2 if watch mode is still in the experimental phase probably not a good idea to switch to it just yet. I'm using node v18.16.0.

Closing this cause it's been out for a while and I'ma stick with nodemon for now.