import type { NextConfig } from "next"; import { join } from "node:path"; // In a pnpm workspace + Turbopack setup, Next can't always infer the monorepo // root (it walks up looking for next/package.json). Pin it explicitly so both // dev and production builds resolve files correctly inside the Docker image. const workspaceRoot = join(import.meta.dirname, "..", ".."); const nextConfig: NextConfig = { reactStrictMode: true, output: "standalone", outputFileTracingRoot: workspaceRoot, transpilePackages: ["@cmbot/db", "@cmbot/shared"], experimental: { typedRoutes: true, }, turbopack: { root: workspaceRoot, resolveExtensions: [".tsx", ".ts", ".jsx", ".js", ".mjs", ".json"], resolveAlias: { // Turbopack doesn't strip the `.js` extension alias that NodeNext requires. // Map the compiled-style paths back to the real TS source files. "@cmbot/db/schema.js": `${workspaceRoot}/packages/db/src/schema.ts`, }, }, }; export default nextConfig;