import { withPayload } from "@payloadcms/next/withPayload"; import path from "node:path"; import { fileURLToPath } from "node:url"; import packageJson from "./package.json" with { type: "json" }; /** @type {import('next').NextConfig} */ const nextConfig = { // Your Next.js config here env: { version: packageJson.version, }, // Pin the workspace root to this repo dir so the standalone build emits a // flat .next/standalone/server.js (Next otherwise walks up looking for // lockfiles and can pick a parent directory — here a stray // /home/jason/package-lock.json two levels up would nest the standalone // tree under .next/standalone/WebstormProjects/polaris-task-force/, which // breaks the Dockerfile's `COPY .../standalone ./` + `CMD ["node","server.js"]`). outputFileTracingRoot: path.resolve(path.dirname(fileURLToPath(import.meta.url))), webpack: (webpackConfig) => { webpackConfig.resolve.extensionAlias = { ".cjs": [".cts", ".cjs"], ".js": [".ts", ".tsx", ".js", ".jsx"], ".mjs": [".mts", ".mjs"], }; return webpackConfig; }, transpilePackages: [ "@payloadcms/richtext-lexical", "lexical", "@lexical/react", "@lexical/rich-text", "@lexical/history", "@lexical/list", "@lexical/link", "@lexical/markdown", "@lexical/selection", "@lexical/table", "@lexical/utils", ], output: "standalone", }; export default withPayload(nextConfig, { devBundleServerPackages: true });