Next.js Discord

Discord Forum

What should I import for URL in "NextResponse.redirect(new URL('/destination', request.url))"?

Unanswered
Bighead carp posted this in #help-forum
Open in Discord
Bighead carpOP
hi, does anyone know what should I import for URL in NextResponse.redirect(new URL('/destination', request.url))?
the documentation does not states what type if URL should I import
I imported:
import {URL} from "url";

but I get:
Error [TypeError]: url__WEBPACK_IMPORTED_MODULE_1__.URL is not a constructor

2 Replies

nothing
the URL class is a global object