2023-07-05 15:11:16 +02:00
|
|
|
---
|
|
|
|
title: 'Invalid `next` Import'
|
|
|
|
---
|
2022-04-05 17:57:45 +02:00
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Why This Error Occurred
|
2022-04-05 17:57:45 +02:00
|
|
|
|
|
|
|
Somewhere in your application, you imported `next` directly which is only meant to be used with legacy custom servers.
|
|
|
|
|
|
|
|
You should not import `next` inside of pages or components.
|
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Possible Ways to Fix It
|
2022-04-05 17:57:45 +02:00
|
|
|
|
|
|
|
Ensure any usage of `import next from "next"` is specific to custom server usage and isn't included in your pages or components.
|
|
|
|
|
|
|
|
Also ensure any type imports are kept inside of TypeScript files e.g. ensure `import { PageConfig } from 'next'` isn't used in JavaScript files.
|
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Useful Links
|
2022-04-05 17:57:45 +02:00
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
- [Custom Server Documentation](/docs/pages/building-your-application/configuring/custom-server)
|