@@ -49,12 +49,15 @@ export async function createServerBundle(options: buildHelper.BuildOptions) {
4949
5050 const remainingRoutes = new Set < string > ( ) ;
5151
52- const { appBuildOutputPath, monorepoRoot } = options ;
53-
54- const packagePath = path . relative ( monorepoRoot , appBuildOutputPath ) ;
52+ const { appBuildOutputPath } = options ;
5553
5654 // Find remaining routes
57- const serverPath = path . join ( appBuildOutputPath , ".next" , "standalone" , packagePath , ".next" , "server" ) ;
55+ const serverPath = path . join (
56+ appBuildOutputPath ,
57+ ".next/standalone" ,
58+ buildHelper . getPackagePath ( options ) ,
59+ ".next/server"
60+ ) ;
5861
5962 // Find app dir routes
6063 if ( fs . existsSync ( path . join ( serverPath , "app" ) ) ) {
@@ -111,7 +114,7 @@ async function generateBundle(
111114 // `node_modules` inside `.next/standalone`, and others inside
112115 // `.next/standalone/package/path` (ie. `.next`, `server.js`).
113116 // We need to output the handler file inside the package path.
114- const packagePath = path . relative ( monorepoRoot , appBuildOutputPath ) ;
117+ const packagePath = buildHelper . getPackagePath ( options ) ;
115118 fs . mkdirSync ( path . join ( outputPath , packagePath ) , { recursive : true } ) ;
116119
117120 const ext = fnOptions . runtime === "deno" ? "mjs" : "cjs" ;
@@ -167,7 +170,7 @@ async function generateBundle(
167170 const overrides = fnOptions . override ?? { } ;
168171
169172 const isBefore13413 = buildHelper . compareSemver ( options . nextVersion , "13.4.13" ) <= 0 ;
170- const isAfter141 = buildHelper . compareSemver ( options . nextVersion , "14.0.4 " ) >= 0 ;
173+ const isAfter141 = buildHelper . compareSemver ( options . nextVersion , "14.1 " ) >= 0 ;
171174
172175 const disableRouting = isBefore13413 || config . middleware ?. external ;
173176
0 commit comments