File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
packages/runtime/src/helpers Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ import {
23
23
const matchesMiddleware = ( middleware : Array < string > , route : string ) : boolean =>
24
24
middleware . some ( ( middlewarePath ) => route . startsWith ( middlewarePath ) )
25
25
26
+ const generateHiddenPathRedirects = ( { basePath } : Pick < NextConfig , 'basePath' > ) : NetlifyConfig [ 'redirects' ] =>
27
+ HIDDEN_PATHS . map ( ( path ) => ( {
28
+ from : `${ basePath } ${ path } ` ,
29
+ to : '/404.html' ,
30
+ status : 404 ,
31
+ force : true ,
32
+ } ) )
33
+
26
34
const generateLocaleRedirects = ( {
27
35
i18n,
28
36
basePath,
@@ -262,21 +270,12 @@ export const generateRedirects = async ({
262
270
join ( netlifyConfig . build . publish , 'routes-manifest.json' ) ,
263
271
)
264
272
265
- netlifyConfig . redirects . push (
266
- ...HIDDEN_PATHS . map ( ( path ) => ( {
267
- from : `${ basePath } ${ path } ` ,
268
- to : '/404.html' ,
269
- status : 404 ,
270
- force : true ,
271
- } ) ) ,
272
- )
273
+ netlifyConfig . redirects . push ( ...generateHiddenPathRedirects ( { basePath } ) )
273
274
274
275
if ( i18n && i18n . localeDetection !== false ) {
275
276
netlifyConfig . redirects . push ( ...generateLocaleRedirects ( { i18n, basePath, trailingSlash } ) )
276
277
}
277
278
278
- netlifyConfig . redirects . push ( ...generateCustom404Redirects ( { i18n } ) )
279
-
280
279
// This is only used in prod, so dev uses `next dev` directly
281
280
netlifyConfig . redirects . push (
282
281
// API routes always need to be served from the regular function
You can’t perform that action at this time.
0 commit comments