ts-node-dev hot reaload dose not recognize my import file in index.ts
SuperWallaby opened this issue · comments
My server index.ts
file import consoleColorFy.ts
consoleColorFy.ts
declare global {
interface Console {
redBg: TConsoleFn;
}
}
console["redBg"] = ...
Now i can use console.redBg()
.
It works well in most time but when hot-reload some server's file
I got this error.
Property 'redBg' does not exist on type 'Console'.
>> console.redBg("error", error);
consoleColorFy.ts
, which is imported first, will always work because all code starts from index.ts
.
But when ts-node-dev
run hot-reloaded
by change of code, it seems to only rework some file. and it dose not recognise my consoleColorFy.ts
Hum.... any advice?
"ts-node-dev --respawn --no-notify --rs src/index.ts --env=dev"
It works well when I restart server
ts-node-dev": "^1.1.1"
I'm facing a similar problem. I've a logger declared as global variable.
In app.ts
import {log, Logger} from 'bluelog'
declare global {
var log: Logger
}
global.log = log
console.log('log', log)
In another file I've:
log("log something")
When the application starts, all logs work fine. If any error inducing code is added and then fixed, the terminal starts throwing log not found
error. Then, again I have to exit and restart server, Hot reload is not able to find it. Sometimes it works too.