File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ const validateNextUsage = function (failBuild) {
1212 )
1313 }
1414
15+ // We cannot load `next` at the top-level because we validate whether the
16+ // site is using `next` inside `onPreBuild`.
1517 // Old Next.js versions are not supported
1618 const { version } = require ( 'next/package.json' )
1719 if ( ltVersion ( version , MIN_VERSION ) ) {
Original file line number Diff line number Diff line change 1- const { getSortedRoutes : getSortedRoutesFromNext } = require ( 'next/dist/next-server/lib/router/utils/sorted-routes' )
21const removeFileExtension = require ( './removeFileExtension' )
32
43// Return an array of redirects sorted in order of specificity, i.e., more generic
@@ -9,8 +8,11 @@ const getSortedRedirects = (redirects) => {
98 // after sorting
109 const routesWithoutExtensions = redirects . map ( ( { route } ) => removeFileExtension ( route ) )
1110
11+ // We cannot load `next` at the top-level because we validate whether the
12+ // site is using `next` inside `onPreBuild`.
1213 // Sort the "naked" routes
13- const sortedRoutes = getSortedRoutesFromNext ( routesWithoutExtensions )
14+ const { getSortedRoutes } = require ( 'next/dist/next-server/lib/router/utils/sorted-routes' )
15+ const sortedRoutes = getSortedRoutes ( routesWithoutExtensions )
1416
1517 // Return original routes in the sorted order
1618 return redirects . sort ( ( a , b ) => {
You can’t perform that action at this time.
0 commit comments