RyanP13
RyanP13

Reputation: 7743

Next.js, TypeScript and tsconfig.json 'jsx' property being overwritten

How to stop the jsx property being overwritten from 'react' to 'preserve' by NextJS when running the development server?

My tsconfig.json file:

  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ]
}

AFAIK the jsx option must be react to compile my tsx files to jsx.

Upvotes: 9

Views: 6068

Answers (1)

RyanP13
RyanP13

Reputation: 7743

Answered here:

https://github.com/kulshekhar/ts-jest/issues/937

Essentially you extend the current tsconfig.json with one specifically for jest and then reference that tsconfig.json from your jest.config.js.

Upvotes: 6

Related Questions