File tree 2 files changed +6
-2
lines changed
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) {
12
12
)
13
13
}
14
14
15
+ // We cannot load `next` at the top-level because we validate whether the
16
+ // site is using `next` inside `onPreBuild`.
15
17
// Old Next.js versions are not supported
16
18
const { version } = require ( 'next/package.json' )
17
19
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' )
2
1
const removeFileExtension = require ( './removeFileExtension' )
3
2
4
3
// Return an array of redirects sorted in order of specificity, i.e., more generic
@@ -9,8 +8,11 @@ const getSortedRedirects = (redirects) => {
9
8
// after sorting
10
9
const routesWithoutExtensions = redirects . map ( ( { route } ) => removeFileExtension ( route ) )
11
10
11
+ // We cannot load `next` at the top-level because we validate whether the
12
+ // site is using `next` inside `onPreBuild`.
12
13
// 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 )
14
16
15
17
// Return original routes in the sorted order
16
18
return redirects . sort ( ( a , b ) => {
You can’t perform that action at this time.
0 commit comments