Build a script in lib mode and a website at the same time #8222
Replies: 5 comments 4 replies
-
|
Did you get the solution? |
Beta Was this translation helpful? Give feedback.
-
|
Pointers would be helpful |
Beta Was this translation helpful? Give feedback.
-
|
Still totally stuck on this. Need to build a lib and demo site for local dev |
Beta Was this translation helpful? Give feedback.
-
|
@mquandalle Any update on how you are addressing this these days? |
Beta Was this translation helpful? Give feedback.
-
|
I don't think a single Vite build pass can be both:
The docs describe those as two different build shapes:
So your current instinct is basically right: once you switch on The practical solution is usually not "force one config to do both in one build", but:
For example:
That can still be cleaner than maintaining two fully separate configs if you factor out the shared pieces and call Vite twice (or use two npm scripts / a small JS build runner). So my read is:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I use to Vite to :
It uses Vite library mode
Currently I have to use two different vite config : website and external script. These 2 distincts configs introduce some complexity (slightly harder to launch the two build in dev or production mode, maybe some issues with vite internal cache reset when a change is detected on the config), and I wonder if I could simplify it.
It's already possible to have multiple entry points on a vite config, but as far as I know all of them have to be in library mode or not. It isn't possible to generate at the same time a script in library mode and a website alongside. Any idea to solve this?
Beta Was this translation helpful? Give feedback.
All reactions