-
I want to use typescript in every part of the project, not just inside the app folder. When we create the directory with express template while selecting typescript, server file is a JS file. I wanted to convert it to TS but then the dev command doesn't work, because it needs to be compiled to JS. and idk how to do that with the TS config file. Does anyone have an example ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Rename the sever.js to server.ts Update tsconfig.json {
"module": "NodeNext",
"moduleResolution": "Bundler",
} Install npm install tsx Update package.json "scripts": {
"dev": "remix dev --manual -c \"tsx ./server.ts\"",
"start": "cross-env NODE_ENV=production tsx ./server.ts",
}, |
Beta Was this translation helpful? Give feedback.
-
The latest update to 'remix + express' template from Remix uses vite inside the server.js file.
The reason I had to ignore './vite.config.ts*' from 'tsx watch' is, It has started to work well for me. I have to see if it continues. |
Beta Was this translation helpful? Give feedback.
-
I created a Vite plugin that lets you use Express for development and production entirely in TypeScript. No special build steps. It's all handled automatically by Vite and Remix. |
Beta Was this translation helpful? Give feedback.
Rename the sever.js to server.ts
Update tsconfig.json
https://www.totaltypescript.com/concepts/option-module-must-be-set-to-nodenext-when-option-moduleresolution-is-set-to-nodenext
Install
tsx
packageUpdate package.json