Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno compile ignores JSX settings #20532

Closed
petersalas opened this issue Sep 17, 2023 · 3 comments
Closed

deno compile ignores JSX settings #20532

petersalas opened this issue Sep 17, 2023 · 3 comments
Labels
bug Something isn't working correctly cli related to cli/ dir compile related to the `deno compile` feature

Comments

@petersalas
Copy link

deno compile seems to ignore JSX settings in deno.json that are honored by deno run.

For example:

// deno.json
{
    "compilerOptions": {
      "jsx": "react-jsx",
      "jsxImportSource": "custom"
    },
    "importMap": "./import.json"
  }
// import.json
{
    "imports": {
        "custom/jsx-runtime": "./jsx-runtime.ts"
    }
}
// jsx-runtime.ts
export declare namespace JSX {
  interface IntrinsicElements {
    test: {};
  }
}

export function jsx() {
  console.log("custom JSX factory!");
  return 1;
}
// main.tsx
const x = <test />;

deno run works as expected:

> deno run main.tsx
custom JSX factory!

But deno compile doesn't seem to honor the JSX settings:

> deno compile --output repro main.tsx
> ./repro
error: Uncaught ReferenceError: React is not defined
const x = /*#__PURE__*/ React.createElement("test", null);
@lucacasonato lucacasonato added bug Something isn't working correctly cli related to cli/ dir compile related to the `deno compile` feature labels Sep 18, 2023
@marvinhagemeister
Copy link
Contributor

A Fresh user just ran into this. @dsherret Is that a difficult fix?

@sgvictorino
Copy link

sgvictorino commented May 13, 2024

I believe this was fixed by #22164(edit: actually, #22521), in 1.41.0.

@dsherret
Copy link
Member

I don't think it was fixed by that one, but yeah this seems to be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir compile related to the `deno compile` feature
Projects
None yet
Development

No branches or pull requests

5 participants