vite:dep-pre-bundle cannot resolve entry for some Chakra UI packages
See original GitHub issueDescription
I have a Vite SPA using React and Typescript template from Vite. After installing dependencies and running “yarn dev” which starts the development server, errors like this pop up: “[plugin vite:dep-pre-bundle] Failed to resolve entry for package “@chakra-ui/react-utils”. The package may have incorrect main/module/exports specified in its package.json.”
Link to Reproduction
https://github.com/frle10/chakra-ui-package-versions-bug
Steps to reproduce
- Clone repo from link to reproduction
- Install dependencies using yarn (yarn berry is set up in the repo, make sure you’re installing with it)
- Run yarn dev
- See errors in logs from yarn dev that I described
Chakra UI Version
2.2.4
Browser
Google Chrome 103.0.5060.134
Operating System
- macOS
- Windows
- Linux
Additional Information
Some error messages you should see:
[plugin vite:dep-scan] Failed to resolve entry for package "@chakra-ui/react".
The package may have incorrect main/module/exports specified in its package.json.
The plugin "vite:dep-scan" was triggered by this import
src/main.tsx:4:31:
4 │ import { ChakraProvider } from '@chakra-ui/react';
Interesting note, if you use yarn 1.22.19 and not yarn berry, everything works normally.
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:13 (3 by maintainers)
Top Results From Across the Web
chakra-react-select - npm
A Chakra UI wrapper for the popular library React Select. ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >How to create forms with Chakra UI in React apps
To find the complete reference to style props, please refer to the official documentation here. Some of the common ones you are going...
Read more >Code completion and auto-import don't work for Chakra-UI ...
I've noticed that if some Chakra-Ui component has already been imported into ... Delete Node Modules and package-lock.json - Invalidate Cache and Restart...
Read more >Chakra UI: Sleek UI Components for React - KnowledgeHut
In the Chakra UI component library, there are several shorthand variations of the style props. The official documentation has a detailed ...
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 FreeTop 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
Top GitHub Comments
This is because the latest published packages are all missing the dist folder. They are all like 2 or 3kb and empty except for readme and package.json For some reason, yarn 2+ is resolving them as the latest versions, even though they appear to have been published with the “dev” tag and not the “latest” one…
My temporary workaround is to address all the affected packages by resolving them to the last patch version with the “resolutions” key at the root of my package.json like below:
@frle10 feel free to copy paste that resolutions key, and then do
yarn install
in your project root… should get you going in the meantime until the bad versions are fixed.I’m taking a look at this today and will get it fixed.