Skip to content

Export jsx-dev-runtime as an alias for jsx-runtime #14619

@KurtGokhan

Description

@KurtGokhan

Astro Info

Astro                    v5.15.1
Node                     v24.3.0
System                   macOS (arm64)
Package Manager          bun
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/react
                         @astrojs/mdx
                         @astrojs/sitemap
                         @astrojs/partytown

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I was trying to use Astro's JSX in regular .tsx files but run into an issue in dev where it says:

Missing "./jsx-dev-runtime" specifier in "astro" package

This is because although jsx-runtime is exported, jsx-dev-runtime is not.

What's the expected result?

I expect JSX to work out of the box for dev and build modes.

There is a simple workaround though. If this is added to the Vite config, everything works as expected.

    resolve: {
      alias: {
        'astro/jsx-dev-runtime': 'astro/jsx-runtime',
      },
    },

The issue can be solved quite easily by adding this to the exports section of package.json of astro package.

    "./jsx-dev-runtime": {
      "types": "./jsx-runtime.d.ts",
      "default": "./dist/jsx-runtime/index.js"
    },

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-azafjsrn?file=src%2Fcomponents%2FSimpleButton.tsx

StackBlitz doesn't work reliably for some reason. But you can clone to local and reproduce the issue.

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: nice to haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions