-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update plugin to the new version of Vite 5.x #258
Comments
This was done in 4.2: https://github.com/vitejs/vite-plugin-react/releases/tag/v4.2.0 What's not working for you? |
@ArnaudBarre here the output on my end:
|
@g3r4n you're probably running vite in cjs mode, see the migration guide: https://vitejs.dev/guide/migration.html#deprecate-cjs-node-api |
Since the issue is lacking v5 support.
In a previously closed vite issue (vitejs/vite#14665) this is said to be because vite-plugin-react 4.1 was used and it was not yet compatible with v5. I’m running vite 5 and vite-plugin-react 4.2 and I’m having the same problem as described after upgrading. 🤔 |
@ArnaudBarre If i changed in packages.json "type": "module", then i see next error. [plugin:vite:react-babel] module is not defined in ES module scope |
@emanuel-lundman This is an issue with a change of types in rollup I didn't catch prior to release, I'm looking into it. You're seeing the error because you didn't enable @sergeushenecz You also need to convert some of your code to ESM and you @schickling You should bump the plugin to 4.2 |
I don't think it's a good idea to override the global api type by adding const hooks = config.plugins
.map((plugin) => plugin.api?.reactBabel as ReactBabelHook | undefined)
.filter(defined) |
I think the initial idea was to provide additional typing information for consumers, not for internal uses. But if this not something supported by rollup typing I will remove this and export the type so that consumer can import it |
Here's what I'm seeing in my remix + storybook project:
|
@stevensacks your error come from a bad state in your package lock. I don't know the equivalent but with yarn I used https://www.npmjs.com/package/yarn-deduplicate |
@emanuel-lundman the fix for the type issue is available in 4.2.1 For others please be sure to have a clean lockfile state and provide a reproduction in a new issue if you still have issues |
Description
Please update plugin to the new version of Vite 5.x
Suggested solution
Update to the new API and peer dep
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: