fresh
fresh copied to clipboard
Cannot use automatic jsx runtime in fresh
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?
The automatic runtime configured via deno.json is not supported in Deno Deploy as of now.
@lucacasonato thanks for the info, much appreciated :)
@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.
FYI: automatic JSX runtime support was recently added to esbuild via https://github.com/evanw/esbuild/pull/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
).
Deno Deploy now also supports automatic runtime via deno.json
and via /** @jsxImportSource */
:)
That is to say: automatic JSX runtime coming to a fresh near you soon!
@lucacasonato if this isn’t already being worked on, I’d be happy to take a stab at it
I'm already working on it. Thanks for the offer though! (Currently blocked by an upstream Deno bug)
Update: the upstream bug should be fixed in Deno 1.24.3.
JSX automatic mode support has landed in #610. It will be part of next weeks' Fresh 1.1.0 release.