@@ -621,38 +621,47 @@ function bindingToApi(
621621 ...options ,
622622 nextConfig : await serializeNextConfig (
623623 options . nextConfig ,
624- path . join ( options . rootPath , options . projectPath )
624+ path . join ( options . rootPath , options . projectPath ) ,
625+ options . dev
625626 ) ,
626627 env : rustifyEnv ( options . env ) ,
627628 }
628629 }
629630
630631 async function rustifyPartialProjectOptions (
631- options : Partial < ProjectOptions >
632+ options : Partial < ProjectOptions > ,
633+ dev : boolean
632634 ) : Promise < NapiPartialProjectOptions > {
633635 return {
634636 ...options ,
635637 nextConfig :
636638 options . nextConfig &&
637639 ( await serializeNextConfig (
638640 options . nextConfig ,
639- path . join ( options . rootPath ! , options . projectPath ! )
641+ path . join ( options . rootPath ! , options . projectPath ! ) ,
642+ dev
640643 ) ) ,
641644 env : options . env && rustifyEnv ( options . env ) ,
642645 }
643646 }
644647
645648 class ProjectImpl implements Project {
646649 private readonly _nativeProject : { __napiType : 'Project' }
650+ private dev : boolean
647651
648- constructor ( nativeProject : { __napiType : 'Project' } ) {
652+ constructor ( nativeProject : { __napiType : 'Project' } , dev : boolean ) {
649653 this . _nativeProject = nativeProject
654+ this . dev = dev
650655 }
651656
652657 async update ( options : Partial < ProjectOptions > ) {
658+ if ( options . dev !== undefined ) {
659+ // TODO: Can we actually switch between dev and prod or is that just the types?
660+ this . dev = options . dev
661+ }
653662 await binding . projectUpdate (
654663 this . _nativeProject ,
655- await rustifyPartialProjectOptions ( options )
664+ await rustifyPartialProjectOptions ( options , this . dev )
656665 )
657666 }
658667
@@ -795,7 +804,8 @@ function bindingToApi(
795804
796805 async function serializeNextConfig (
797806 nextConfig : NextConfigComplete ,
798- projectPath : string
807+ projectPath : string ,
808+ dev : boolean
799809 ) : Promise < string > {
800810 // Avoid mutating the existing `nextConfig` object. NOTE: This is only a shallow clone.
801811 let nextConfigSerializable : Record < string , any > = { ...nextConfig }
@@ -1075,7 +1085,8 @@ function bindingToApi(
10751085 {
10761086 throwTurbopackInternalError,
10771087 }
1078- )
1088+ ) ,
1089+ options . dev
10791090 )
10801091 }
10811092}
0 commit comments