cm_whatsapp_bot_v1/apps/web/next.config.ts
yiekheng 499bcf22ed fix(build): production tsc + Next.js workspace root resolution
Three small build-time fixes surfaced when the Docker images first ran
their full production build (previously only dev mode via tsx):

- packages/shared: exclude *.test.ts from tsc (vitest types not needed
  for shipped output), add @types/node dep so node:crypto resolves
- packages/db: add @types/node dep for the same reason
- apps/web: pin Next.js Turbopack root to the workspace root via
  next.config.ts so the bundler doesn't fail to detect the monorepo
  layout from inside the Docker image
2026-05-09 22:54:51 +08:00

23 lines
670 B
TypeScript

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,
},
};
export default nextConfig;