Vite >=3.1.5 breaks Jotai babel plugins
See original GitHub issueDescribe the bug
Vite 3.1.5 changed the processing of package exports. This breaks two Jotai plugins (debug-label and react-refresh).
vite dev chokes with the following error:

Reverting to 3.1.4 makes the error go away.
The author of Jotai thinks this may be a vite problem, not a problem with Jotai itself.
See discussion with initial analysis here: https://github.com/pmndrs/jotai/issues/1475
Reproduction
https://github.com/gunters63/jotei-vite-import-error
Steps to reproduce
pnpm install, then pnpm dev
System Info
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 AMD Ryzen 9 6900HS with Radeon Graphics
Memory: 6.27 GB / 31.26 GB
Binaries:
Node: 18.10.0 - C:\Program Files\nodejs\node.EXE
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.608.0), Chromium (106.0.1370.37)
Internet Explorer: 11.0.22621.1
npmPackages:
vite: 3.1.7 => 3.1.4
Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Vite 3.1.5 breaks Jotai babel plugins · Issue #1475 - GitHub
Using the debug label and react refresh plugins does not work anymore starting with Vite 3.1.5. vite dev chokes with the following error:....
Read more >Vite — Jotai, primitive and flexible state management for React
Vite. You can use the plugins from the jotai/babel bundle to enhance your developer experience when using Vite and Jotai. In your vite.config.ts...
Read more >Babel - Storybook
Babel. Storybook's webpack config by default sets up Babel for ES6 transpiling. It has three different modes: CRA - the mode for Create...
Read more >docs/guides/vite.mdx | jotai@v1.6.5 - Deno
You can use the plugins from the `jotai/babel` bundle to enhance your developer experience when using Vite and Jotai. In your `vite.config.ts`: ```tsimport ......
Read more >How to combine Webpack 4 and Babel 7 to create a fantastic ...
Babel introduced a breaking change (for the greater good, ... @babel/plugin-syntax-dynamic-import This is what helps with code splitting.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah ok, my mistake!
Yeah, I worded my comment poorly. I wasn’t saying that it was the only or even the main intent of #10683, but I noticed it was implied in the
overrideConditions
description.I implemented in a way that we could do like that in future. But that is not the main intent of that PR. The intent was to make
module
not be used when config bundling.I think removing
module
condition from the normal Vite pipeline is a different thing from this issue. (IMO Vite should usemodule
condition forisRequire: false
because of the intent of this condition: https://github.com/webpack/webpack/issues/11014, https://github.com/rollup/rollup/issues/3514, https://github.com/rollup/plugins/tree/master/packages/node-resolve#exportconditions)About chaging the
resolve.conditions
, I’ve left explanations about it in #10917.