Closed kalvenschraut closed 1 year ago
I think this should be implemented in userland like the proposed solution. I'm not sure if there's many usecase for build --watch
users where this is required as a first-class API. But happy to reconsider too if there's more request for this.
Description
I use tsup for more simpler projects that don't require all the configuration of vite (mainly vue plugins) and it has a feature I find very useful. An onSuccess flag which then allows me to run a command whenever its watch mode has successfully rebuilt. In this I would like to trigger vue-tsc and then tsc-alias to replace aliases. Currently I am having to run concurrently and each individual program in watch mode which is not ideal.
Suggested solution
Add another plugin called onBuildSuccess or something similar and use the rollup writeBundle hook.
Something like the below
Alternative
No response
Additional context
Currently in a monorepo, I have vite in build mode with -m development and -w flags bundling my "common" package for my UI code. I would like to trigger the types code to be rebuilt anytime vite's watch triggers.
I half started a potential PR for this if this is something the team is looking to accept I can look at finishing it. Although not sure if any effort is being done to avoid node specific APIs like exec if vite is trying to run in deno.
Validations