File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1- import path from 'path'
21import type { Plugin , UserConfig } from 'vite'
32
43export interface ClientBuildOptions {
5- outDir ?: string
4+ outDir ?: string // Client output directory
5+ emptyOutDir ?: boolean // Whether to empty the output directory before build
66}
77
8- export const defaultClientBuildOptions : Required < ClientBuildOptions > = {
9- outDir : 'dist' ,
8+ export const defaultClientBuildOptions : Partial < ClientBuildOptions > = {
9+ outDir : 'public' ,
10+ emptyOutDir : true ,
1011}
1112
1213export function clientBuild ( options ?: ClientBuildOptions ) : Plugin {
@@ -21,12 +22,10 @@ export function clientBuild(options?: ClientBuildOptions): Plugin {
2122 } ,
2223
2324 config ( ) : UserConfig {
24- // Output to 'dist/public' (or custom outDir/public)
25- const clientOutDir = path . join ( mergedOptions . outDir , 'public' )
26-
2725 return {
2826 build : {
29- outDir : clientOutDir ,
27+ outDir : mergedOptions . outDir ,
28+ emptyOutDir : mergedOptions . emptyOutDir ,
3029 } ,
3130 }
3231 } ,
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ export interface SrvxOptions extends DevServerOptions {
88 outDir ?: string ;
99 serverOutFile ?: string ;
1010 framework ?: "vercel" ; // Target framework for deployment
11+ // Client build options
12+ clientOutDir ?: string ; // Client output directory (default: "public")
13+ clientEmptyOutDir ?: boolean ; // Whether to empty the client output directory before build (default: true)
1114}
1215
1316export const defaultSrvxOptions : Partial < SrvxOptions > = {
@@ -30,7 +33,8 @@ export function srvx(options?: SrvxOptions): Plugin[] {
3033
3134 // Client build plugin
3235 clientBuild ( {
33- outDir : mergedOptions . outDir ,
36+ outDir : mergedOptions . clientOutDir ,
37+ emptyOutDir : mergedOptions . clientEmptyOutDir ,
3438 } ) ,
3539
3640 // Server build plugin
You can’t perform that action at this time.
0 commit comments