Skip to content

Conversation

ArnaudBarre
Copy link
Member

Alternative to #20702 and vitejs/vite-plugin-react#799 from @poteto which make it easier to keep the template in sync

@ArnaudBarre ArnaudBarre self-assigned this Aug 30, 2025
@ArnaudBarre ArnaudBarre changed the title feat(create-vite): support react compiler feat(create-vite): support React Compiler Aug 30, 2025
@poteto
Copy link

poteto commented Aug 30, 2025

oh this is better, thank you!

const asObject = JSON.parse(content)
const devDepsEntries = Object.entries(asObject.devDependencies)
devDepsEntries.push([
'babel-plugin-react-compiler',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing that's missing is also using [email protected]. Version 6 will include compiler diagnostics as part of the plugin by default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite a bump in dependencies. plugin-proposal-private-methods is deprecated, and I'm surprise of the need for zod in a linter plugin.
Is the hermes parser necessary given that the build will use the babel parser?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as much an issue, but are you open to switching to ESM for the next major? ESLint v9 is now quite the norm and fully support ESM. I can make a PR to either reduce the dependency or switch to ESM if you think there is a chance it lands

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArnaudBarre yes, the eslint plugin now bundles the compiler as well since it can be used standalone. That means a few extra dependencies are needed. Is that blocking anything?

As for ESM I think that will require a larger discussion with the rest of the React team.

@sapphi-red sapphi-red added the feat: create-vite create-vite package label Aug 31, 2025
@sapphi-red
Copy link
Member

I think there're two other ways:

  1. add react compiler by default
  2. add a comment in vite config so that users can easily add react compiler
  3. (the current way) add a new temlpate

Do you have any thoughts about the other ways?

@ArnaudBarre
Copy link
Member Author

The compiler by default would mean we don't run OXC by default. Which can impact the boot time of the starter (I didn't yet benchmark it). This would also mean keeping Babel by default. But given what is the next version of eslint-plugin-react-hooks, we woud need to revisit eslint by default if our goal is to have a light template

I think the benefit of having a template with already the compiler setup is to make it easy to quickly try a pattern on a empty app. That said, the way the template is setup forbid the usage via stackblitz which is the easiest way to create repro...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: create-vite create-vite package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants