@@ -32,14 +32,15 @@ function createTauriDevConfig() {
3232}
3333
3434// Get target from CLI arg, or detect from platform
35- const cliArg = process . argv [ 2 ] ;
35+ const cliArgs = process . argv . slice ( 2 ) . filter ( arg => ! arg . startsWith ( '--' ) ) ;
36+ const cliArg = cliArgs [ 0 ] ;
3637let target ;
3738
3839if ( cliArg === 'tauri' || cliArg === 'electron' ) {
3940 target = cliArg ;
4041} else if ( cliArg ) {
4142 console . error ( `Unknown target: ${ cliArg } ` ) ;
42- console . error ( 'Usage: npm run serve [tauri|electron]' ) ;
43+ console . error ( 'Usage: npm run serve [tauri|electron] [--dist] ' ) ;
4344 process . exit ( 1 ) ;
4445} else {
4546 // Auto-detect: Linux uses Electron, Windows/Mac use Tauri
@@ -79,6 +80,7 @@ if (target === "tauri") {
7980 console . log ( 'Starting Tauri dev server...' ) ;
8081 await execa ( "npx" , [ "tauri" , "dev" , "--config" , "./src-tauri/tauri-local.conf.json" ] , { stdio : "inherit" } ) ;
8182} else {
83+ const serveDist = process . argv . includes ( '--dist' ) ;
8284 const srcNodePath = resolve ( "../phoenix/src-node" ) ;
8385 console . log ( `Running "npm install" in ${ srcNodePath } ` ) ;
8486 await execa ( "npm" , [ "install" ] , { cwd : srcNodePath , stdio : "inherit" } ) ;
@@ -95,6 +97,13 @@ if (target === "tauri") {
9597 const packageJson = JSON . parse ( readFileSync ( packageJsonPath , 'utf8' ) ) ;
9698 const effectiveConfig = JSON . parse ( readFileSync ( configDest , 'utf8' ) ) ;
9799 effectiveConfig . version = packageJson . version ;
100+
101+ // When --dist flag is passed, serve from ../phoenix/dist instead of ../phoenix/src
102+ if ( serveDist ) {
103+ console . log ( 'Serving from ../phoenix/dist (--dist mode)' ) ;
104+ effectiveConfig . phoenixLoadURL = effectiveConfig . phoenixLoadURL . replace ( '/src/' , '/dist/' ) ;
105+ }
106+
98107 writeFileSync ( configDest , JSON . stringify ( effectiveConfig , null , 2 ) ) ;
99108
100109 console . log ( 'Starting Electron...' ) ;
0 commit comments