3c87e1b52a
## 📖 What's in there? With Edge Function GA for API Routes, it would make sense to suggest developer to change their runtime key from `experimental-edge` to `edge`. Current behavior is: 1. when using `experimental-edge` in API route: > prints a warning _once:_ `warn - You are using an experimental edge runtime, the API might change.` 1. when using `experimental-edge` in pages: > prints a warning _once:_ `warn - You are using an experimental edge runtime, the API might change. ` 1. when using `edge` in pages: > throws an error _for each page_: `error - Page /xyz provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.` This PR adjust case # 1 to indicates which API file is using `experimental-edge` (a warning per page), and suggest to migrate: `warn - /pages/api/xyz provided runtime 'experimental-edge'. It can be updated to 'edge' instead.` - [x] Integration tests added ## 🧪 How to test? Besides running e2e tests with `NEXT_TEST_MODE=dev pnpm testheadless --testPathPattern edge-configurable-runtime`, you can create a test app in `examples` folder: ```jsx // examples/edge-warnings/pages/api/edge.js export default () => new Response('ok') export const config = { runtime: 'experimental-edge' } // examples/edge-warnings/pages/index.jsx export default () => <p>hello world</p> export const runtime = 'experimental-edge' ``` Build next.js then run with `pnpm next dev examples/edge-warnings`. You can try adding more pages with `experimental-edge` runtime (will not produce more warnings), adding more API with `experimental-edge` (will produce new warnings), or change page runtime to `edge` (will produce errors). |
||
---|---|---|
.. | ||
.stats-app | ||
__mocks__ | ||
development | ||
e2e | ||
integration | ||
lib | ||
production | ||
unit | ||
.gitignore | ||
jest-setup-after-env.ts | ||
jest.d.ts | ||
readme.md | ||
test-file.txt |