import { registerHooks } from "node:module"; // Lets Node's type stripping resolve the extensionless relative imports the Next.js bundler accepts. registerHooks({ resolve(specifier, context, nextResolve) { try { return nextResolve(specifier, context); } catch (error) { if (error.code !== "ERR_MODULE_NOT_FOUND" || !specifier.startsWith(".")) throw error; return nextResolve(`${specifier}.ts`, context); } }, });