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

Cannot use automatic jsx runtime in fresh #382

Closed
lifeiscontent opened this issue Jul 3, 2022 · 10 comments
Closed

Cannot use automatic jsx runtime in fresh #382

lifeiscontent opened this issue Jul 3, 2022 · 10 comments

Comments

@lifeiscontent
Copy link

I changed my deno.json to:

{
  "$schema": "https://cdn.deno.land/deno/versions/v1.23.2/raw/cli/schemas/config-file.v1.json",
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  },
  "tasks": {
    "start": "deno run -A --watch=static/,routes/ dev.ts"
  },
  "importMap": "./import_map.json"
}

but it doesn't work due to several lines in the fresh codebase explicitly setting

/** @jsx h */

Is there a reason for this? Why not use the automatic runtime always?

@lucacasonato
Copy link
Member

The automatic runtime configured via deno.json is not supported in Deno Deploy as of now.

@lifeiscontent
Copy link
Author

@lucacasonato thanks for the info, much appreciated :)

@uipoet
Copy link

uipoet commented Jul 7, 2022

@lucacasonato is there a work-a-round in the meantime? I am working on a React component library that relies on the automatic import of React and trying to determine if I need to refactor upstream.

@tylerbrostrom
Copy link
Contributor

tylerbrostrom commented Jul 29, 2022

FYI: automatic JSX runtime support was recently added to esbuild via evanw/esbuild#2349.

That means, at the very least, files inside islands could take advantage of the automatic JSX runtime (if fresh were to update its esbuild dependency, and read in the user’s deno.json).

@lucacasonato
Copy link
Member

Deno Deploy now also supports automatic runtime via deno.json and via /** @jsxImportSource */ :)

@lucacasonato
Copy link
Member

That is to say: automatic JSX runtime coming to a fresh near you soon!

@tylerbrostrom
Copy link
Contributor

@lucacasonato if this isn’t already being worked on, I’d be happy to take a stab at it

@lucacasonato
Copy link
Member

I'm already working on it. Thanks for the offer though! (Currently blocked by an upstream Deno bug)

@lucacasonato
Copy link
Member

Update: the upstream bug should be fixed in Deno 1.24.3.

@lucacasonato
Copy link
Member

JSX automatic mode support has landed in #610. It will be part of next weeks' Fresh 1.1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants