Skip to content

Commit

Permalink
Fix error page doc for no server import in page (vercel#32164)
Browse files Browse the repository at this point in the history
* Fix error page doc for no server import in page

* Feedback changes
  • Loading branch information
molebox authored Dec 7, 2021
1 parent 68d6d1a commit 6274733
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions errors/no-server-import-in-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

### Why This Error Occurred

`next/server` was imported in a page outside of `pages/_middleware.js` (or `pages/_middleware.tsx` if you are using TypeScript)
`next/server` was imported outside of `pages/**/_middleware.{js,ts}`.

### Possible Ways to Fix It

Only import and use `next/server` within `pages/_middleware.js` (or `pages/_middleware.tsx`) to add middlewares.
Only import and use `next/server` in a file located within the pages directory: `pages/**/_middleware.{js,ts}`.

```jsx
```ts
// pages/_middleware.ts

import type { NextFetchEvent, NextRequest } from 'next/server'
Expand Down

0 comments on commit 6274733

Please sign in to comment.