vitejs / vitejs/vite-plugin-react

Add "include" and "exclude" option to `@vitejs/plugin-react-swc`

Open
#486 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: react-swc
Dominant language
TypeScript
Stars
1.2k
Forks
269
Avg merge
1d 3h
Merged PRs (30d)
19

Description

Related plugins
Description

I want to use SolidJS inside of a React app. With @vitejs/plugin-react I can simply exclude all files that end with *.solid.tsx.

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import solid from "vite-plugin-solid";

export default defineConfig({
  plugins: [
    react({ exclude: "./src/**/*.solid.tsx" }),
    solid({ include: "./src/**/*.solid.tsx" }),
  ],
});

Is this somehow also possible with @vitejs/plugin-react-swc? Here is an example playground using @vitejs/plugin-react.

https://stackblitz.com/edit/vitejs-vite-uteimcxq?file=src%2Freact-app.tsx,src%2Fsolid-app.solid.tsx,vite.config.ts

Suggested solution

Add "include" and "exclude" option to @vitejs/plugin-react-swc

Alternative

No response

Additional context

No response

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the plugin-react-swc package linked in the issue and compare its configuration with plugin-react's include and exclude behavior. Verify the requested SolidJS/React setup, then confirm that matching .solid.tsx files can be excluded from React processing while other files continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.