You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the improvement or update you wish to see?
Can we get some context on why importing from next/server should not be done?
Is there any context that might help us understand?
I am wanting to make some reusable middleware functions that are placed outside of pages, so I need to import NextRequest and NextResponse, and it's unclear to me what I'm at risk of breaking by importing what amounts to type information.
Does the docs page already exist? Please link to it.
This rule was good and kinda made sense when we had nested Middleware.
Now that we have a single Middleware, one might extract logic into different places
and I don't think we should limit importing `NextResponse` or `NextRequest`.
## Related
- Closes#36239
- Closes#37309
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
What is the improvement or update you wish to see?
Can we get some context on why importing from
next/server
should not be done?Is there any context that might help us understand?
I am wanting to make some reusable middleware functions that are placed outside of
pages
, so I need to importNextRequest
andNextResponse
, and it's unclear to me what I'm at risk of breaking by importing what amounts to type information.Does the docs page already exist? Please link to it.
https://nextjs.org/docs/messages/no-server-import-in-page
The text was updated successfully, but these errors were encountered: