Skip to content

[Bug]: Rolldown is not honouring jsxImportSource in tsconfig.json #3473

@YarnSphere

Description

@YarnSphere

Reproduction link or steps

Rolldown seems to currently ignore the jsxImportSource declaration in tsconfig.json. I haven't checked whether the jsx, jsxFactory, and jsxFragmentFactory compiler options are currently being honoured, but it's possible that they also aren't.

Repository with a minimal reproduction using preact: https://github.com/YarnSphere/rolldown-jsx-import-source

  • Install dependencies and run the build script.

What is expected?

The provided code should compile with no warnings and correctly reference preact's JSX function.

Notably, explicitly adding a TypeScript pragma to files containing JSX (/** @jsxImportSource preact */) does work around the issue, as described in oxc-project/oxc#3560.

Here's the expected build output for the referenced project (and current build output when explicitly adding the pragma):

> rolldown -c

<DIR>/app.js  chunk │ size: 16.71 kB                                                                                                                                                                    
                                                                                                                                                                                                        
✔ Finished in 15.69 ms

The bundled JavaScript correctly bundles and references preact's JSX function.

What is actually happening?

Here's the current build output:

> rolldown -c

[UNRESOLVED_IMPORT] Warning: Could not resolve 'react/jsx-runtime' in src/index.tsx

<DIR>/app.js  chunk │ size: 15.97 kB                                                                                                                                                                    
                                                                                                                                                                                                        
✔ Finished in 18.32 ms 

The bundled JavaScript then starts with an incorrect:

import { jsx } from "react/jsx-runtime";

System Info

System:
  OS: Linux 6.12 Fedora Linux 41 (Workstation Edition)
  CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
  Memory: 40.13 GB / 62.21 GB
  Container: Yes
  Shell: 3.7.0 - /usr/bin/fish
Binaries:
  Node: 22.11.0 - /usr/bin/node
  npm: 10.9.0 - /usr/bin/npm
  pnpm: 9.13.0 - /usr/bin/pnpm
npmPackages:
  rolldown: latest => 1.0.0-beta.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions