Skip to content

Conversation

Milancen123
Copy link
Contributor

  • 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.

- 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.
@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Sep 21, 2025
@ijjk
Copy link
Member

ijjk commented Sep 21, 2025

Allow CI Workflow Run

  • approve CI run for commit: 8e3ca10

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@icyJoseph
Copy link
Contributor

icyJoseph commented Sep 22, 2025

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 :)

@icyJoseph icyJoseph merged commit 2d96b96 into vercel:canary Sep 22, 2025
65 checks passed
icyJoseph added a commit that referenced this pull request Sep 29, 2025
…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]>
@github-actions github-actions bot added the locked label Oct 6, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Documentation Related to Next.js' official documentation. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants