@@ -126,13 +126,9 @@ export class BundlerCompilerService
126126 }
127127
128128 // Copy Vite output files directly to platform destination
129- const distOutput = path . join (
130- projectData . projectDir ,
131- ".ns-vite-build" ,
132- ) ;
133- const destDir = path . join (
134- platformData . appDestinationDirectoryPath ,
135- this . $options . hostProjectModuleName ,
129+ const { distOutput, destDir } = this . getVitePaths (
130+ platformData ,
131+ projectData ,
136132 ) ;
137133
138134 if ( debugLog ) {
@@ -389,13 +385,9 @@ export class BundlerCompilerService
389385 // the Static Binding Generator with no input. Copy the full
390386 // Vite bundle here instead.
391387 if ( this . getBundler ( ) === "vite" ) {
392- const distOutput = path . join (
393- projectData . projectDir ,
394- ".ns-vite-build" ,
395- ) ;
396- const destDir = path . join (
397- platformData . appDestinationDirectoryPath ,
398- this . $options . hostProjectModuleName ,
388+ const { distOutput, destDir } = this . getVitePaths (
389+ platformData ,
390+ projectData ,
399391 ) ;
400392 this . copyViteBundleToNative ( distOutput , destDir ) ;
401393 }
@@ -864,6 +856,21 @@ export class BundlerCompilerService
864856 return this . $projectConfigService . getValue ( `bundler` , "webpack" ) ;
865857 }
866858
859+ // The Vite output directory and its destination in the native project —
860+ // shared by the watch-mode `emittedFiles` copy and the non-watch copy.
861+ private getVitePaths (
862+ platformData : IPlatformData ,
863+ projectData : IProjectData ,
864+ ) : { distOutput : string ; destDir : string } {
865+ return {
866+ distOutput : path . join ( projectData . projectDir , ".ns-vite-build" ) ,
867+ destDir : path . join (
868+ platformData . appDestinationDirectoryPath ,
869+ this . $options . hostProjectModuleName ,
870+ ) ,
871+ } ;
872+ }
873+
867874 private copyViteBundleToNative (
868875 distOutput : string ,
869876 destDir : string ,
0 commit comments