Deploying MERN typescript project to render

When I am trying to deploy my project I am getting the below error multiple times, mostly for each file in the client side, I am using MERN stack with typescript, it is my first time to use this stack with typescript so I am not sure if the configuration are correct or not, this is the error and will share more details below:

client/src/App.tsx(5,20): error TS6142: Module './pages/signIn/SignIn' was resolved to '/opt/render/project/src/client/src/pages/signIn/SignIn.tsx', but '--jsx' is not set

I am having 2 folders “api” for backend and “client” for frontend:

package.json:

{
  "name": "studportal",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "install-deps": "npm install && npm install --prefix client",
    "build-server": "tsc",
    "build-client": "npm run build --prefix client",
    "build": "npm run install-deps && npm run build-server && npm run build-client",
    "start": "node dist/index.js",
    "dev": "nodemon --watch \"api/**\" --ext \"ts,json\" --exec \"ts-node api/index.ts\""
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@types/express": "^4.17.21",
    "@types/mongoose": "^5.11.97",
    "@types/node": "^20.9.0",
    "cookie-parser": "^1.4.6",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "mongodb": "^6.2.0",
    "mongoose": "^8.0.0",
    "ts-node": "^10.9.1"
  },
  "devDependencies": {
    "nodemon": "^3.0.1",
    "typescript": "^5.2.2"
  }
}

tsconfig.json:

"compilerOptions": {
  "target": "es2016",   
"module": "commonjs",  
 "allowImportingTsExtensions": true, 
"outDir": "./dist", 
"noEmit": true, 
 "esModuleInterop": true,  
 "forceConsistentCasingInFileNames": true,  
 "strict": true, 
 "skipLibCheck": true 

inside the client folder:

package.json:

"name": "client",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },

...dependenies

tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,
        

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

Hi there,

What version of React are you using? Does it help if you change your tsconfig to use "jsx": "preserve"?

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.