DEV Community

Discussion on: Create a React component library with Vite and Typescript

Collapse
 
loannpowell profile image
LoannPowell

With this project structure i have to run build every time that i have a change in my library no? how can i solve that

Collapse
 
nicolaserny profile image
Nicolas Erny

True, you have to rebuild the library to see the changes in the example. Most of the time, it's not an issue because you use the storybook (with a devserver) while you do intensive developments in the library.
However, if you want to rebuild automatically the library, I suggest to check out this tool: nodemon.io/

Collapse
 
bastianw profile image
Bastian Wegge • Edited

You can just npm run build:vite -- --watch

Thread Thread
 
nicolaserny profile image
Nicolas Erny

Thanks :)

Thread Thread
 
noam3kch profile image
Noam Neeman • Edited

this will not update the d.ts file so linked packages won't have any updated types. any solution around this that is not nodemon? @bastianw

Thread Thread
 
damian_cyrus profile image
Damian Cyrus

You could use something like concurrently. You can run both watch commands in parallel.

Thread Thread
 
nicolaserny profile image
Nicolas Erny

Thanks for sharing. I've discovered recently a similar tool npm-run-all