-
Notifications
You must be signed in to change notification settings - Fork 89
fix: publish from subdirectory #1756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2558855
69d8210
c1cf874
112b225
ba479be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import type { PrerenderManifest, SsgRoute } from 'next/dist/build' | |
import { outdent } from 'outdent' | ||
import { join } from 'pathe' | ||
|
||
import { HANDLER_FUNCTION_PATH, HIDDEN_PATHS, ODB_FUNCTION_PATH } from '../constants' | ||
import { HANDLER_FUNCTION_PATH, ODB_FUNCTION_PATH } from '../constants' | ||
|
||
import { getMiddleware } from './files' | ||
import { ApiRouteConfig } from './functions' | ||
|
@@ -25,14 +25,6 @@ import { | |
const matchesMiddleware = (middleware: Array<string>, route: string): boolean => | ||
middleware.some((middlewarePath) => route.startsWith(middlewarePath)) | ||
|
||
const generateHiddenPathRedirects = ({ basePath }: Pick<NextConfig, 'basePath'>): NetlifyConfig['redirects'] => | ||
HIDDEN_PATHS.map((path) => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed anymore, as these aren't published There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are/were There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They were the files in |
||
from: `${basePath}${path}`, | ||
to: '/404.html', | ||
status: 404, | ||
force: true, | ||
})) | ||
|
||
const generateLocaleRedirects = ({ | ||
i18n, | ||
basePath, | ||
|
@@ -66,21 +58,6 @@ const generateLocaleRedirects = ({ | |
return redirects | ||
} | ||
|
||
export const generateStaticRedirects = ({ | ||
netlifyConfig, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to redirect, because the files are in the right place |
||
nextConfig: { i18n, basePath }, | ||
}: { | ||
netlifyConfig: NetlifyConfig | ||
nextConfig: Pick<NextConfig, 'i18n' | 'basePath'> | ||
}) => { | ||
// Static files are in `static` | ||
netlifyConfig.redirects.push({ from: `${basePath}/_next/static/*`, to: `/static/:splat`, status: 200 }) | ||
|
||
if (i18n) { | ||
netlifyConfig.redirects.push({ from: `${basePath}/:locale/_next/static/*`, to: `/static/:splat`, status: 200 }) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems i18n still loads from |
||
} | ||
|
||
/** | ||
* Routes that match middleware need to always use the SSR function | ||
* This generates a rewrite for every middleware in every locale, both with and without a splat | ||
|
@@ -243,8 +220,6 @@ export const generateRedirects = async ({ | |
join(netlifyConfig.build.publish, 'routes-manifest.json'), | ||
) | ||
|
||
netlifyConfig.redirects.push(...generateHiddenPathRedirects({ basePath })) | ||
|
||
if (i18n && i18n.localeDetection !== false) { | ||
netlifyConfig.redirects.push(...generateLocaleRedirects({ i18n, basePath, trailingSlash })) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have we removed serverless from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We force builds to use
server
target anyway, and in Next 13serverless
breaks the build.