TypeScript + NodeJS run program

Hi to all.

I started using WebStorm a while ago and I please need some help on the following: Inside the IDE, I can run my TypeScript Node.JS program by creating a run configuration either with the bundled TSX (=running TypeScript without first compile to JS) or by specify the Node interpreter in that Run Configuration window (=running the compiled JS files which is the actual thing that will happen in the production environment)

Which is the right way?

Thanks in advance for any help!

0

Both ways are right, it depends on your goals. If you just like to quickly preview the results without emitting the .js files, you can use the bundled tsx. To get the results similar to the ones you will have in production, build the files first.

0

Hi Elena, thank you for your help!

So, in the case of building a project that I need to be absolutely sure that will run correctly in both production and the IDE, better to use the second way (node run config), correct? (and I saw that the IDE can auto-compile the js files automatically!)

And I suppose that the debugger will work in both ways correctly?

Thank you again!

0

You are very welcome!

Yes, the second way is preferable. The debugger should work in both ways,you just need to make sure that the source maps are enabled in your tsconfig.json. Should you face any issues,please contact us.

0

请先登录再写评论。