@@ -62,7 +62,7 @@ export async function generateRoutingRules(
6262 nextAdapterContext : OnBuildCompleteContext ,
6363 netlifyAdapterContext : NetlifyAdapterContext ,
6464) {
65- const escapedBuildId = escapeStringRegexp ( nextAdapterContext . buildId )
65+ // const escapedBuildId = escapeStringRegexp(nextAdapterContext.buildId)
6666
6767 const hasMiddleware = Boolean ( nextAdapterContext . outputs . middleware )
6868 const hasPages =
@@ -72,7 +72,7 @@ export async function generateRoutingRules(
7272 nextAdapterContext . outputs . appPages . length !== 0 ||
7373 nextAdapterContext . outputs . appRoutes . length !== 0
7474 const shouldDenormalizeJsonDataForMiddleware =
75- hasMiddleware && hasPages && nextAdapterContext . config . skipMiddlewareUrlNormalize
75+ hasMiddleware && hasPages && ! nextAdapterContext . config . skipMiddlewareUrlNormalize
7676
7777 // group redirects by priority, as it impact ordering of routing rules
7878 const priorityRedirects : RoutingRuleApply [ ] = [ ]
@@ -128,7 +128,7 @@ export async function generateRoutingRules(
128128 {
129129 description : 'Normalize _next/data' ,
130130 match : {
131- path : `^${ nextAdapterContext . config . basePath } /_next/data/${ escapedBuildId } /(.*)\\.json` ,
131+ path : `^${ nextAdapterContext . config . basePath } /_next/data/${ nextAdapterContext . buildId } /(.*)\\.json` ,
132132 has : [
133133 {
134134 type : 'header' ,
@@ -140,6 +140,7 @@ export async function generateRoutingRules(
140140 type : 'rewrite' ,
141141 destination : `${ nextAdapterContext . config . basePath } /$1${ nextAdapterContext . config . trailingSlash ? '/' : '' } ` ,
142142 } ,
143+ continue : true ,
143144 } ,
144145 {
145146 description : 'Fix _next/data index normalization' ,
@@ -156,6 +157,7 @@ export async function generateRoutingRules(
156157 type : 'rewrite' ,
157158 destination : `${ nextAdapterContext . config . basePath } /` ,
158159 } ,
160+ continue : true ,
159161 } ,
160162 ]
161163 : [ ]
@@ -177,6 +179,7 @@ export async function generateRoutingRules(
177179 type : 'rewrite' ,
178180 destination : `${ nextAdapterContext . config . basePath } /index` ,
179181 } ,
182+ continue : true ,
180183 } ,
181184 {
182185 description : 'Denormalize _next/data' ,
@@ -193,6 +196,7 @@ export async function generateRoutingRules(
193196 type : 'rewrite' ,
194197 destination : `${ nextAdapterContext . config . basePath } /_next/data/${ nextAdapterContext . buildId } /$1.json` ,
195198 } ,
199+ continue : true ,
196200 } ,
197201 ]
198202 : [ ]
@@ -312,23 +316,22 @@ export async function generateRoutingRules(
312316
313317 // server actions name meta routes
314318
315- ...denormalizeNextData , // originally: // if skip middleware url normalize we denormalize _next/data if middleware + pages
316-
317319 ...( hasMiddleware
318320 ? [
319321 {
320322 // originally: middleware route
321323 description : 'Middleware' ,
322324 // match: {
325+ // path: 'test',
326+ // },
327+ // match: {
323328 // path: 'wat',
324329 // },
325330 apply : { type : 'middleware' } ,
326331 } as const ,
327332 ]
328333 : [ ] ) ,
329334
330- ...normalizeNextData , // originally: // if skip middleware url normalize we normalize _next/data if middleware + pages
331-
332335 // ...convertedRewrites.beforeFiles,
333336
334337 // add 404 handling if /404 or locale variants are requested literally
@@ -487,6 +490,7 @@ export async function generateRoutingRules(
487490 routingPhase : 'rewrite' ,
488491 } ,
489492
493+ ...denormalizeNextData ,
490494 // denormalize _next/data if middleware + pages
491495
492496 // apply _next/data routes (including static ones if middleware + pages)
@@ -508,7 +512,7 @@ export async function generateRoutingRules(
508512 '/' ,
509513 nextAdapterContext . config . basePath ,
510514 '/_next/data/' ,
511- escapedBuildId ,
515+ nextAdapterContext . buildId ,
512516 '/(.*).json' ,
513517 ) } `,
514518 } ,
@@ -529,7 +533,7 @@ export async function generateRoutingRules(
529533 '/' ,
530534 nextAdapterContext . config . basePath ,
531535 '/_next/data/' ,
532- escapedBuildId ,
536+ nextAdapterContext . buildId ,
533537 '/(.*).json' ,
534538 ) } `,
535539 } ,
0 commit comments