@vercel/build-utils
Advanced tools
Comparing version 2.3.2-canary.3 to 2.3.2-canary.4
@@ -32,3 +32,4 @@ import { Route } from '@vercel/routing-utils'; | ||
rewriteRoutes: Route[] | null; | ||
errorRoutes: Route[] | null; | ||
}>; | ||
export {}; |
@@ -60,2 +60,3 @@ "use strict"; | ||
rewriteRoutes: null, | ||
errorRoutes: null, | ||
}; | ||
@@ -100,2 +101,3 @@ } | ||
rewriteRoutes: null, | ||
errorRoutes: null, | ||
}; | ||
@@ -154,2 +156,3 @@ } | ||
rewriteRoutes: null, | ||
errorRoutes: null, | ||
}; | ||
@@ -190,2 +193,3 @@ } | ||
rewriteRoutes: null, | ||
errorRoutes: null, | ||
}; | ||
@@ -214,2 +218,3 @@ } | ||
rewriteRoutes: routesResult.rewriteRoutes, | ||
errorRoutes: routesResult.errorRoutes, | ||
}; | ||
@@ -649,2 +654,7 @@ } | ||
const rewriteRoutes = []; | ||
const errorRoutes = []; | ||
const isNextjs = frontendBuilder && | ||
((frontendBuilder.use && frontendBuilder.use.startsWith('@vercel/next')) || | ||
(frontendBuilder.config && | ||
frontendBuilder.config.framework === 'nextjs')); | ||
if (apiRoutes && apiRoutes.length > 0) { | ||
@@ -707,2 +717,11 @@ if (options.featHandleMiss) { | ||
} | ||
if (options.featHandleMiss && !isNextjs) { | ||
// Exclude Next.js to avoid overriding custom error page | ||
// https://nextjs.org/docs/advanced-features/custom-error-page | ||
errorRoutes.push({ | ||
status: 404, | ||
src: '^/(?!.*api).*$', | ||
dest: options.cleanUrls ? '/404' : '/404.html', | ||
}); | ||
} | ||
return { | ||
@@ -712,2 +731,3 @@ defaultRoutes, | ||
rewriteRoutes, | ||
errorRoutes, | ||
}; | ||
@@ -714,0 +734,0 @@ } |
{ | ||
"name": "@vercel/build-utils", | ||
"version": "2.3.2-canary.3", | ||
"version": "2.3.2-canary.4", | ||
"license": "MIT", | ||
@@ -51,3 +51,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "c80bb37e8d66eac83da40746cf1a15ba42d216d8" | ||
"gitHead": "4e005274f964f0dd384b8f535a0f1fe48503ddf0" | ||
} |
Sorry, the diff of this file is too big to display
1239256
30432