Skip to content

React import line not injected in symlinked files #965

@y-nk

Description

@y-nk

Related plugins

Describe the bug

i'm having a monorepo where i build a backend app and i need jsx/tsx to work to render emails. i've setup the email part as a lib package of my monorepo. the package is symlinked, included at the build and works great except for this one thing: tsx files are missing import * as React from 'react' and therefore the code breaks.

Reproduction

https://github.com/y-nk/repro-965

Steps to reproduce

git clone https://github.com/y-nk/repro-965
cd repro-xxxx
pnpm i
pnpm --filter="@test/app" build
cat app/dist/lib/src/email.js

the email file should be missing the React import line which is commonly injected otherwise.

System Info

System:
    OS: macOS 26.0.1
    CPU: (8) arm64 Apple M2
    Memory: 16.00 GB
  Binaries:
    Node: 22.16.0
    pnpm: 10.13.1

Used Package Manager

pnpm

Notes

i have included a few elements of context (email rendering lib) to highlight that the usecase is strong, as well as why i'm using the swc version in the vite.config.

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions