Vite tasks and a monorepo in which some vite.config.ts files depend on the build output of other packages #2861
|
We have a monorepo which contains application libraries, and applications themselves. The application I could work around this by adding a custom pre-build script which run's the build commands directly on the library package, before being able to run What is the recommended way to solve this? |
Replies: 1 comment 1 reply
|
On 1.0.0 you can keep import { defineConfig } from 'vite-plus';
import { createAppConfig } from '@repro/helper';
export default defineConfig({
...createAppConfig(),
run: {
tasks: {
build: {
command: 'vp build',
dependsOn: ['@repro/helper#build'],
},
},
},
});
I tried it in a pnpm workspace. Before, |
On 1.0.0 you can keep
vp runfrom executing the app configs by making theirrunfield statically readable: the default export is adefineConfig(...)call fromvite-plus,runis a plain literal after the last spread, and the app's build depends on the library build.vp runloads the task graph for the whole workspace before it looks at the package you targeted, and Vite+ only executes avite.config.tswhen it can'…