I cannot get the TS Server logging to work for my build script. I need it as I want to learn how to make a plugin for TypeScript.
The VS Code logs won't do, so no use pointing me to the Open TS Server log
command.
If I understand correctly, I need to set the TTS_LOG
environment variable before running tsc
.
https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#setting-up-typescript-server-logging
So here is what I tried:
package.json
, but no log file appeared after using it with npm run build
. My code compiled correctly though.{
"script": {
"build": "cross-env TSS_LOG=\"-logToFile true -file D:\\ts-server.log -level verbose\" tsc"
}
}
npx cross-env TSS_LOG="-logToFile true -file D:\ts-server.log -level verbose" tsc
tsc
> $Env:TSS_LOG="-logToFile true -file D:\ts-server.log -level verbose"
> npx tsc
tsc
$ TSS_LOG="-logToFile true -file D:\ts-server.log -level verbose"
$ npx tsc
tsc
> SET TSS_LOG="-logToFile true -file D:\ts-server.log -level verbose"
> npx tsc
D:/ts-server.log
What am I doing wrong?
Here is my setup:
Update: I just tried on Ubuntu 20.04.5 LTS with Node 20.11.1 and I cannot get a log either, so now I'm sure it is not OS related.
I dived into TypeScript's code and fount out tsc
doesn't use TS Server to begin with. Then, looking back at the tutorial I linked in the question, I realized its about plugins meant to be tested and used on VS Code (maybe on other IDEs too).
So, to answer my question:
tsc