Reputation: 2428
When I run nodemon dist/index.js
nodemon runs the server, but if I use nodemon -w dist/index.js
, it just keeps starting, without actually running my server.
I transpiled my index.js file from Typescript and it looks like this:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const App_1 = require("./App");
const port = process.env.PORT || 3000;
App_1.default.listen(port, (err) => {
if (err) {
return console.log(err);
}
return console.log(`server is listening on ${port}`);
});
//# sourceMappingURL=index.js.map
As far as I can tell the .js file doesn't change anymore after I transpiled it from typescript using the tsc -b
command.
What could cause nodemon to keep starting? And how do I fix it?
Upvotes: 0
Views: 224
Reputation: 152
With nodemon is better use ts-node. This library is good for development because with ts-lint you can run TypeScript file.
nodemon.json ```
{
"watch": ["server/**/*.ts"],
"execMap": {
"ts": "ts-node"
}
}
```
package.json
"dev": "nodemon server/index.ts"
Upvotes: 1