rsnext/errors/import-next.md
JJ Kasper b1a7b88890
Add warning when importing "next" directly (#35884)
* Add warning when importing "next" directly

* Apply suggestions from code review

Co-authored-by: Balázs Orbán <info@balazsorban.com>

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* add example

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Steven <steven@ceriously.com>
2022-04-05 10:57:45 -05:00

649 B

Invalid "next" Import

Why This Error Occurred

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.

Possible Ways to Fix It

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.