/** * Node.js ESM resolve hook used by the CORS verification harness. * * Next.js ships no package.json "exports" map, so the canonical bare specifier * `next/server` does not resolve under raw Node ESM (the Next.js bundler * resolves it itself). This hook maps it to the actual CJS file so the * middleware module under test (src/lib/http/cors.ts, which imports * `next/server`) can be loaded by plain `node` for verification. */ export async function resolve(specifier, context, nextResolve) { if (specifier === "next/server") { return nextResolve("next/server.js", context); } return nextResolve(specifier, context); }