dnt icon indicating copy to clipboard operation
dnt copied to clipboard

Let me change `jsx` compilerOption

Open pschiffmann opened this issue 2 years ago • 0 comments

My deno code contains jsx tags like: <div>hello world</div. I have configured my project to use React from npm, and use the automatic runtime, like so:

{
  "imports": {
    "react": "npm:[email protected]",
    "react/jsx-runtime": "npm:[email protected]/jsx-runtime"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "react"
  }
}

This setup works well locally as well as on Deno Deploy. However, when I try to compile this code with dnt, I get a bunch of these errors: error TS2686: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.

The problem here is that dnt uses a hard-coded jsx compiler option value, and doesn't let me overwrite it:

https://github.com/denoland/dnt/blob/2d1d120df7f110c510c6d2aa07e9d0886855e182/mod.ts#L284-L286

pschiffmann avatar Mar 14 '24 15:03 pschiffmann