I have to manually remove
dist/app.js
to see the latest changes. I have this start script in my package.json
"start": "tsc && node dist/app.js"
is it by default node just keep the dist folder so I have to remove it before I compile it?
I have to manually remove
dist/app.js
to see the latest changes. I have this start script in my package.json
"start": "tsc && node dist/app.js"
is it by default node just keep the dist folder so I have to remove it before I compile it?
To remove the dist folder you can have your package.json
file as follows:
{
"name": "sample",
"version": "1.0.0",
"description": "",
"main": "dist/app.js",
"scripts": {
"clean": "rm -rf dist",
"build": "tsc",
"start": "npm run clean && npm run build && node dist/app.js"
},
"keywords": [],
"author": "Jayant Malik",
"license": "MIT",
"dependencies": {
"nodemon": "^2.0.6",
"typescript": "^4.1.2"
}
}
TS won't remove files in dist
folder if it's not during development mode;
See this issue: https://github.com/Microsoft/TypeScript/issues/13722
A simple solution would be to remove the dir (you can use rimraf for OS robustness)