-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Discussion: make Vite more friendly to library development (like storybook) #725
Comments
Another issue that I found that might be relevant for this is that if you would like to use ES modules outside of Vite (which you can do by adding |
I have added your statement into the issue body. |
I've honestly never encountered a package where the demo's config and (dev) dependencies are declared in the root package directory. You might want to move it all to the demo folder entirely (example), or move each of the demo into its own (private) package |
@intrnl |
wished i found a better example, but here it is
|
Related issue: #330 |
Related Issue and PR on storybook: storybookjs/storybook#10654, storybookjs/storybook#13384 |
With Vite 2.x, we can now achieve ideal monorepo layout:
I have updated the demo repo: https://github.com/csr632/test-vite/tree/lib-monorepo I think all problems in this issue are solved. Closing this issue... |
This issue has been locked since it has been closed for more than 14 days. If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion. |
Describe the bug
I am developing a component library, using vite as a local dev environment (like storybook). I also build the demos with vite and deploy it, so that our designers can see my demos.
In my case, the component library consists of many component, and each component is a separate package. So it is a monorepo, like this :
I make it works (see the reproduction repo, but there is some flaws and hacks in it. It is because that vite keeps assuming the whole project is a vite app. (In my case, it is actually a package for my component).
Here is some flaws that make vite not an ideal for library development. You can observe them in the reproduction repo.
/demos
, because it is config for demos, not the component package. I am not able to do that because I have set vite root to/
(because demos import things from/src
), and vite hard-code html path as${root}/index.html
. (You can try to move it in the reproduction repo)#{root}/package.json
and "treat it like a config for vite". But in the case of library development, it is made for the npm package!@pika/react
and@pika/react-dom
inside package.json#dependencies. All users of my package will install them! I have created an issue at vite-plugin-react."type": "module"
inside package.json also has surprising effects on vite.package.json#dependencies
by default.I love vite. I think it can be a very handy tool for library development. (Better than storybook!)
Reproduction
https://github.com/csr632/test-vite/tree/lib-monorepo
Based on the reproduction repo, how can the workflow and file structure be improved?
System Info
vite
version: 1.0.0-rc.4The text was updated successfully, but these errors were encountered: