How to combine Node + React + Typescript

Hi,

I want to make an app in Node with React, all with Typescript.

When i create a node project all js files are in .js. Of course i can create new .ts file but do i have to compile them manually ?

I think i have to use webpack with gulp but i don't know how to do. What is the best practice ?

Thanks.

0
2 comments

>app in Node with React, all with Typescript

well... Would you like to create a new server (written in Typescript) for hosting your React app? Or?

>When i create a node project all js files are in .js.

Do you mean Node.js express app template? This is not the only way to create a Node.js application - you can create an empty project and start populating it with your stuff, or download a project stub and open it in WebStorm via File | Open

 

>I think i have to use webpack with gulp but i don't know how to do. What is the best practice ?

 

this is just a matter of preferences - you can transpile files with tsc compiler (built-in, or run it in terminal), or use a build tool/bundler of your choice to perform the corresponding tasks

0
Avatar
Permanently deleted user

I wanted to Node compile React at server-side before to send to the client, but i dropped this idea now.

Now, all my project use typescript files and i use npm modules 'ts-node' for compiling & start, and 'nodemon' as file watcher.

Thank you for your answer, issue fixed :)

0

Please sign in to leave a comment.