Because readFile is relative to your current working directory
but I am into src
No you aren't
Is this command ran after cd'ing into src?
i just use it to compile my ts file
So your current working directory is not src
how can i tell to ts to consider src as my working dir?
I think use process.cwd() in the readFile instead of ./
can i do something wiht typescript config?
I think that is completely unrelated to readFile. the tsconfig stuff is for telling the compiler where to look when it builds the ts into js
.
// tconfig.json { "compilerOptions": { "rootDir": "src", ... "ts-node": { "transpileOnly": true, "files": true, "compilerOptions": { "rootDir": "." } } }
cd src && npx ts-node-dev --respawn --transpile-only test.ts
it works but i dont want to go inside src, like this
That's what "current working directory" means
shouldn't be related to the file where Im writing the code?
Обсуждают сегодня