@@ -49,12 +49,15 @@ export async function createServerBundle(options: buildHelper.BuildOptions) {
49
49
50
50
const remainingRoutes = new Set < string > ( ) ;
51
51
52
- const { appBuildOutputPath, monorepoRoot } = options ;
53
-
54
- const packagePath = path . relative ( monorepoRoot , appBuildOutputPath ) ;
52
+ const { appBuildOutputPath } = options ;
55
53
56
54
// 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
+ ) ;
58
61
59
62
// Find app dir routes
60
63
if ( fs . existsSync ( path . join ( serverPath , "app" ) ) ) {
@@ -111,7 +114,7 @@ async function generateBundle(
111
114
// `node_modules` inside `.next/standalone`, and others inside
112
115
// `.next/standalone/package/path` (ie. `.next`, `server.js`).
113
116
// We need to output the handler file inside the package path.
114
- const packagePath = path . relative ( monorepoRoot , appBuildOutputPath ) ;
117
+ const packagePath = buildHelper . getPackagePath ( options ) ;
115
118
fs . mkdirSync ( path . join ( outputPath , packagePath ) , { recursive : true } ) ;
116
119
117
120
const ext = fnOptions . runtime === "deno" ? "mjs" : "cjs" ;
@@ -167,7 +170,7 @@ async function generateBundle(
167
170
const overrides = fnOptions . override ?? { } ;
168
171
169
172
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 ;
171
174
172
175
const disableRouting = isBefore13413 || config . middleware ?. external ;
173
176
0 commit comments