Skip to content

Request: Clarify "out-of-the-box" JSX/TSX support #8939

@kjkent

Description

@kjkent

📋 Explain your issue

I'm confused trying to understand the extent to which Astro, without the React (or another framework) integration, supports JSX/TSX syntax.

Support for .jsx and .tsx files is currently mentioned in the docs here and here (both on the guides/imports page)

It is noted:

While Astro understands JSX syntax out-of-the-box, you will need to include a framework integration to properly render frameworks like React, Preact and Solid.

Could the extent to which the syntax/filetype is supported be explained a little more explicitly? I can see types for JSXTransformConfig and JSXTransformFn in the Astro source, but writing even the simplest JSX, such as const testJsx = () => <p>Hello, world!</p> leads to a build error like Cannot find module 'react/jsx-dev-runtime' imported from <testJsx.jsx>

In the docs-given example:

import { MyComponent } from './MyComponent.jsx';

What JSX could be declared/implemented/returned by MyComponent that would not require a framework integration to be installed?

It's late, so I appreciate I may not be firing on all cylinders, but I do wonder if this clarification may be a beneficial amendment to the docs. I appreciate your time; thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedIssues looking for someone to run with them!improve or update documentationEnhance / update existing documentation (e.g. add example, improve description, update for changes)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions