Conversation
7a9ebf1 to
a20730e
Compare
a20730e to
557b801
Compare
There was a problem hiding this comment.
Looks cool, thanks for the cleanup, I'm happy I will be able stop downloading babel!
We need to updates the docs (both Readmes in the repo and vite.dev)
I think we should also add a section on how to add babel to a Vite 8 project, promoting this new plugin and all the possibilities for filtering.
| function viteReactForCjs(this: unknown, options: Options): Plugin[] { | ||
| return viteReact.call(this, options) | ||
| } | ||
| Object.assign(viteReactForCjs, { |
There was a problem hiding this comment.
If this needed when supporting only Vite 8+ which means require(esm) IIRM?
There was a problem hiding this comment.
This is needed to keep the value of require('@vitejs/plugin-react'). If we remove this, the config has to be:
const react = require('@vitejs/plugin-react')
module.exports = {
plugins: [react.default()] // instead of `react()`
}| "noUnusedLocals": true, | ||
| "esModuleInterop": true | ||
| "esModuleInterop": true, | ||
| "rootDir": ".", |
There was a problem hiding this comment.
Is rootDir needed? I thought this would allow importing it like import "src/any-file-inside-project" without type error and I didn't like that before.
There was a problem hiding this comment.
It is needed, otherwise I get the following error:
error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'path/to/vite-plugin-react/packages/plugin-react/package.json'. Supply the
rootDircompiler option to disambiguate.
I thought this would allow importing it like
import "src/any-file-inside-project"without type error
I guess you are confused with baseUrl.
There was a problem hiding this comment.
Ah good to know. Indeed, baseUrl is the one I hated 😅
|
I'll cut a beta version with this PR. |
Description
Built on top of #1124In Vite 8 (currently beta), react refresh transform can be handled by Oxc. This means there's no transform that uses babel by default.
To reduce the install size, I think we should remove babel from the dependency of
@vitejs/plugin-react.The
@rolldown/plugin-babelpackage lives at https://github.com/rolldown/plugins.context: #1114