Nechir-89 / quiz-app-MERN

Quiz application in MERN stack
https://nechir-89.github.io/quiz-app-MERN/
0 stars 0 forks source link

Cannot find module #5

Open Nechir-89 opened 1 year ago

Nechir-89 commented 1 year ago

import router from "./Routes/index";

module extension can be ignored when we import module but with typescript to start running server "start":"ts-node-esm app.ts", We need to set file extension otherwise we will get an error "Cannot find module", if I use typescript then I probably will set .ts as module extension but again it won't work because when module is compiled it will have .js extension and won't have .ts extension anymore, so to fix this we can set extension as .js even if the module originally has .ts extenstion

import router from "./Routes/index.js";