Skip to content

JSR publishing adds wrong jsxRuntime comment with precompile #30264

@marvinhagemeister

Description

@marvinhagemeister

Publishing a package to JSR which has jsx: "precompile" doesn't work correctly. It unexpectedly falls back to the classic jsx transform.

/** @jsxRuntime classic */
/** @jsxImportSource npm:[email protected] */

This in turn leads to errors when you're trying to use deno bundle on these like in this case where I tried to bundle fresh:

bundler warning: The JSX import source cannot be set without also enabling React's "automatic" JSX transform[unsupported-jsx-comment] 
    at deno:https://jsr.io/@fresh/core/2.0.0-alpha.50/src/dev/middlewares/error_overlay/code_frame.tsx:1:48

Proposed solution

Falling back to the classic jsx transform is wrong. It should be set to automatic instead, or even precompile although that might not work with other runtimes.

Steps to reproduce

  1. Clone https://github.com/marvinhagemeister/deno-publish-precompile-bug
  2. Update the name in deno.json to whatever you desire
  3. Publish to JSR with deno publish

Example: https://jsr.io/@marvinh-test/deno-publish-precompile-bug/0.0.1/main.tsx

Version: Deno 2.4.3

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions