Automatically transpile TypeScript file before Run/Debug Follow
I have server-side .ts files that I want to run and debug. I've followed the Running and debugging a server-side TypeScript application with Node.js guide, but was somewhat surprised to see that the file was not automatically transpiled after I modified it and executed its Run configuration.
Every time I make a change in the .ts source, do I have to hunt for the tiny green hammer button to Compile your TypeScript code into JavaScript?
How can that be automated? Do I need to set up a watcher? Use ts-node? Something else? What I ended up doing was add a "Before launch" "Compile TypeScript" step in the Run/Debug config with "Check errors" checked, but if there's an error in an unrelated file in the project, that doesn't compile the file I want to execute.
This is a pretty basic requirement and the recommended solution should be explained in that guide I linked above. Thanks!
Please sign in to leave a comment.
>How can that be automated? Do I need to set up a watcher?
No, you can just enable the Recompile on changes in Settings | Languages & Frameworks | TypeScript; see https://www.jetbrains.com/help/webstorm/2019.3/settings-languages-typescript.html#ws_ts_use_ts_service_checkbox
Thank you, the recompile option is the easiest and most transparent.
Shouldn't it be mentioned at https://www.jetbrains.com/help/webstorm/running-and-debugging-typescript.html#ws_ts_run_debug_server_side ?
Please follow https://youtrack.jetbrains.com/issue/WEB-43774 for updates