## 📖 What's in there? Yesterday we didn't had time to address leftovers from #44045. Here it is. - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added (from [PR 43814](https://github.com/vercel/next.js/pull/43814)) - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## 🧪 How to test? Several tests cases added: - in dev mode, errors and warning: `NEXT_TEST_MODE=dev pnpm testheadless --testPathPattern edge-configurable-runtime` - in build mode, build error for pages on the `edge`: `NEXT_TEST_MODE=start pnpm testheadless --testPathPattern edge-configurable-runtime` Co-authored-by: JJ Kasper <jj@jjsweb.site>
This commit is contained in:
parent
599ca813ae
commit
c2229a3a40
2 changed files with 12 additions and 15 deletions
|
@ -313,17 +313,14 @@ export async function getPageStaticInfo(params: {
|
|||
!isEdgeRuntime(resolvedRuntime)
|
||||
) {
|
||||
const options = Object.values(SERVER_RUNTIME).join(', ')
|
||||
if (typeof resolvedRuntime !== 'string') {
|
||||
Log.error(
|
||||
`The \`runtime\` config must be a string. Please leave it empty or choose one of: ${options}`
|
||||
)
|
||||
const message =
|
||||
typeof resolvedRuntime !== 'string'
|
||||
? `The \`runtime\` config must be a string. Please leave it empty or choose one of: ${options}`
|
||||
: `Provided runtime "${resolvedRuntime}" is not supported. Please leave it empty or choose one of: ${options}`
|
||||
if (isDev) {
|
||||
Log.error(message)
|
||||
} else {
|
||||
Log.error(
|
||||
`Provided runtime "${resolvedRuntime}" is not supported. Please leave it empty or choose one of: ${options}`
|
||||
)
|
||||
}
|
||||
if (!isDev) {
|
||||
process.exit(1)
|
||||
throw new Error(message)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,10 +343,10 @@ export async function getPageStaticInfo(params: {
|
|||
!isAPIRoute(page.replace(/^\/pages\//, '/'))
|
||||
) {
|
||||
const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`
|
||||
Log.error(message)
|
||||
|
||||
if (!isDev) {
|
||||
process.exit(1)
|
||||
if (isDev) {
|
||||
Log.error(message)
|
||||
} else {
|
||||
throw new Error(message)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ describe('Configurable runtime for pages and API routes', () => {
|
|||
expect(output.code).toBe(1)
|
||||
expect(output.stderr).not.toContain(`Build failed`)
|
||||
expect(output.stderr).toContain(
|
||||
`error - Page / provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`
|
||||
`Error: Page / provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue