-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Add warning for API export routes #8250
Conversation
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
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.
❌
@@ -35,6 +36,7 @@ export default async function (dir, options, configuration) { | |||
const threads = options.threads || Math.max(cpus().length - 1, 1) | |||
const distDir = join(dir, nextConfig.distDir) | |||
const subFolders = nextConfig.exportTrailingSlash | |||
let apiPage = false |
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.
This should have a more descriptive name (e.g. warnedAboutApiPage
) or use the execOnce
helper.
// Warn about API pages export | ||
if (isApiRoute && !apiPage) { | ||
apiPage = true | ||
log(` API pages are not supported in export`) |
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.
This message should be flashier IMO, plus it's missing an err.sh
link explaining it.
Unactionable messages are against our logging guidelines.
If I'm a user, what do I do next? Not use next export
? Delete my API Routes? Customize my export path map?
@@ -285,6 +286,17 @@ function runTests (serverless = false) { | |||
} | |||
}) | |||
|
|||
if (!serverless) { |
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.
What does this have to do with the serverless target?
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.
next export
can only be used with server
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 should note that as a comment
This PR adds a warning to
API
exported routes and skip exporting of them.