Replies: 1 comment 6 replies
-
I don't think there is an easy way to solve this right now. Currently, Vite works differently for ids inside node modules in several places, and uses a simple check to define if a file is in node_modules. I think all these references should be changed to a function depending on the Vite config and a new configuration option added. I hope we could keep the simple check though. Is it completely fixed on Bit side that the components will end up in a |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, this is Jinjiang from https://github.com/teambit. I'd like to create this discussion for the bit x vite integration issues we have ever met.
In short, Bit CLI is a tool focusing on component development. In a Bit workspace, every component generates its own package in
node_modules
. For integrating vite into web apps in Bit, the main difference from a normal web app is the entrance of a web app is inside a package innode_modules
.During the integration, we met some issues that the web apps don't work expected. In general these issues include:
We tried different combinations of vite config but didn't find a perfect solution. So I'd like to provide a reproduction of a basic issue to discuss a best approach:
https://github.com/Jinjiang/reproductions/tree/vite-ssr-in-node_modules-20240116
This is a SSR React app. The component is a real simple React component created by Bit, and the web app setup is based on an example on Vite docs. (The setup is supposed to be encapsulated as an app runner in Bit.)
With the same code in
'.'
the web app works. However, it doesn't when it starts from the package innode_modules
.The question: is there a good way to run web apps from a package inside
node_modules
?Thanks.
Beta Was this translation helpful? Give feedback.
All reactions