-
Notifications
You must be signed in to change notification settings - Fork 29.6k
docs: add pageExtensions note to Middleware and clarify default filename #84045
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
Conversation
- Added a Note to the Middleware docs explaining that when `pageExtensions` are customized (e.g. `.page.ts`), the Middleware file should be named `middleware.page.ts` or `middleware.page.js`. - Updated wording so `middleware.ts/js` is described as the default filename, not a strict requirement.
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Edited the PR, I think this is important info, that should go into the flow of the document. Not just a note. I also have #83693 open to document this further within pageExtensions itself. I do believe people who set pageExtensions start from the documentation page, or at least would go there in case of problem, so that's the likely point where you want to know all of the implications upfront. Since I am still working on it, I think this patch to middleware docs is ok :) |
…ame (#84045) - Added a Note to the Middleware docs explaining that when `pageExtensions` are customized (e.g. `.page.ts`), the Middleware file should be named `middleware.page.ts` or `middleware.page.js`. - Updated wording so `middleware.ts/js` is described as the default filename, not a strict requirement. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? -Added a callout note to middleware.mdx stating that if pageExtensions is customized (e.g., .page.ts), the Middleware file should also match (middleware.page.ts/js). -Updated the language from “must” → “default is” for filename clarity. ### Why? -Developers customizing pageExtensions were misled by the existing docs, which implied middleware.ts/js was always required. -This PR prevents confusion when Middleware isn’t recognized after a pageExtensions change. ### How? Edited docs/app/api-reference/file-conventions/middleware.mdx. Inserted a > **Note** block right after the paragraph explaining where to create the middleware file. Closes NEXT- Fixes #84008 --> --------- Co-authored-by: Joseph <[email protected]>
pageExtensions
are customized (e.g..page.ts
), the Middleware file should be namedmiddleware.page.ts
ormiddleware.page.js
.middleware.ts/js
is described as the default filename, not a strict requirement.