Skip to content

Commit eeb6404

Browse files
committed
fix: tRaCe
1 parent 2eba019 commit eeb6404

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

packages/runtime/src/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export const ODB_FUNCTION_TITLE = 'Next.js ISR handler'
88
export const IMAGE_FUNCTION_TITLE = 'next/image handler'
99
// These are paths in .next that shouldn't be publicly accessible
1010
export const HIDDEN_PATHS = [
11-
'/cache/*',
12-
'/server/*',
13-
'/serverless/*',
11+
'/cache',
12+
'/server',
13+
'/serverless',
1414
'/trace',
1515
'/traces',
1616
'/routes-manifest.json',

packages/runtime/src/helpers/redirects.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { PrerenderManifest, SsgRoute } from 'next/dist/build'
77
import { outdent } from 'outdent'
88
import { join } from 'pathe'
99

10-
import { HANDLER_FUNCTION_PATH, HIDDEN_PATHS, ODB_FUNCTION_PATH } from '../constants'
10+
import { HANDLER_FUNCTION_PATH, ODB_FUNCTION_PATH } from '../constants'
1111

1212
import { isAppDirRoute, loadAppPathRoutesManifest } from './edge'
1313
import { getMiddleware } from './files'
@@ -27,14 +27,6 @@ import {
2727
const matchesMiddleware = (middleware: Array<string>, route: string): boolean =>
2828
middleware.some((middlewarePath) => route.startsWith(middlewarePath))
2929

30-
const generateHiddenPathRedirects = ({ basePath }: Pick<NextConfig, 'basePath'>): NetlifyConfig['redirects'] =>
31-
HIDDEN_PATHS.map((path) => ({
32-
from: `${basePath}${path}`,
33-
to: '/404.html',
34-
status: 404,
35-
force: true,
36-
}))
37-
3830
const generateLocaleRedirects = ({
3931
i18n,
4032
basePath,
@@ -281,8 +273,6 @@ export const generateRedirects = async ({
281273
join(netlifyConfig.build.publish, 'routes-manifest.json'),
282274
)
283275

284-
netlifyConfig.redirects.push(...generateHiddenPathRedirects({ basePath }))
285-
286276
if (i18n && i18n.localeDetection !== false) {
287277
netlifyConfig.redirects.push(...generateLocaleRedirects({ i18n, basePath, trailingSlash }))
288278
}

packages/runtime/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { join, relative } from 'path'
33
import type { NetlifyPlugin } from '@netlify/build'
44
import { bold, redBright } from 'chalk'
55
import destr from 'destr'
6-
import { existsSync, readFileSync } from 'fs-extra'
6+
import { existsSync, readFileSync, remove } from 'fs-extra'
77
import { outdent } from 'outdent'
88

9-
import { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME } from './constants'
9+
import { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, HIDDEN_PATHS } from './constants'
1010
import { restoreCache, saveCache } from './helpers/cache'
1111
import {
1212
getNextConfig,
@@ -238,6 +238,13 @@ const plugin: NetlifyPlugin = {
238238
warnForProblematicUserRewrites({ basePath, redirects })
239239
warnForRootRedirects({ appDir })
240240
await warnOnApiRoutes({ FUNCTIONS_DIST })
241+
242+
for (const HIDDEN_PATH of HIDDEN_PATHS) {
243+
const pathToDelete = join(publish, HIDDEN_PATH)
244+
console.log({ pathToDelete })
245+
await remove(pathToDelete)
246+
}
247+
241248
if (experimental?.appDir) {
242249
console.log(
243250
'🧪 Thank you for testing "appDir" support on Netlify. For known issues and to give feedback, visit https://ntl.fyi/next-13-feedback',

0 commit comments

Comments
 (0)