Files
vibn-frontend/next.config.ts
Mark Henderson 41fbed31f3 fix(prod): ESM transpile, healthcheck, hosting UX, settings, error msgs
- next.config.ts: add react-markdown + entire unified/remark/rehype
  ecosystem to transpilePackages — fixes TypeError 'z'/'j'/'aa' prod
  crashes caused by ESM-only packages not being bundled for webpack
- Dockerfile: bake HEALTHCHECK --start-period=60s on 127.0.0.1 so
  rolling deploys pass on first health probe (was failing on ::1 IPv6)
- Hosting tab: full rewrite — live URL chip, copy button, redeploy
  button, inline log viewer, domain list, empty state with prompt
  nudge. Single-card layout replaces master-detail for 1-3 endpoints.
- Settings page: new /project/:id/settings route with danger zone +
  typed "delete" confirmation for project deletion
- Status pill: "View logs" link appears on build failures
- URL chips: collapse extras into "+N more" pill when >2 visible
- Chat errors: structured "Tool error:" prefix; network errors
  distinguished from server errors

Made-with: Cursor
2026-04-30 17:12:48 -07:00

81 lines
2.8 KiB
TypeScript

import type { NextConfig } from "next";
import path from "path";
import { fileURLToPath } from "url";
// This app lives in vibn-frontend; a lockfile under $HOME can make Turbopack pick the wrong root
// and hydrate with a mismatched client bundle (e.g. different JustineNav markup).
const turbopackRoot = path.dirname(fileURLToPath(import.meta.url));
// Google OAuth on localhost: NextAuth must build the same callback URL Google expects.
// If NEXTAUTH_URL is unset in dev, default it (set explicitly if you use 127.0.0.1 or another port).
if (process.env.NODE_ENV === "development" && !process.env.NEXTAUTH_URL?.trim()) {
process.env.NEXTAUTH_URL = "http://localhost:3000";
}
const nextConfig: NextConfig = {
turbopack: {
root: turbopackRoot,
},
output: "standalone",
// ssh2 ships native .node binaries; turbopack can't bundle them
// ("non-ecmascript placeable asset"). Externalize so they're loaded
// at runtime via Node's require, the same way @prisma/client works.
serverExternalPackages: ["@prisma/client", "prisma", "ssh2", "cpu-features"],
// react-markdown and its entire unified/remark/rehype ecosystem are
// ESM-only (type:"module", no CJS fallback). Next.js webpack can't
// resolve them without explicit transpilation — manifests as
// "TypeError: Cannot read properties of undefined (reading 'z')" in
// the minified production bundle.
transpilePackages: [
"react-markdown",
"remark-gfm",
"remark-parse",
"remark-rehype",
"unified",
"vfile",
"vfile-message",
"mdast-util-from-markdown",
"mdast-util-to-markdown",
"mdast-util-gfm",
"mdast-util-gfm-table",
"mdast-util-gfm-task-list-item",
"mdast-util-gfm-strikethrough",
"mdast-util-gfm-autolink-literal",
"mdast-util-gfm-footnote",
"micromark",
"micromark-core-commonmark",
"micromark-extension-gfm",
"micromark-util-combine-extensions",
"micromark-util-character",
"micromark-util-chunked",
"micromark-util-classify-character",
"micromark-util-decode-string",
"micromark-util-encode",
"micromark-util-html-tag-name",
"micromark-util-normalize-identifier",
"micromark-util-resolve-all",
"micromark-util-sanitize-uri",
"micromark-util-subtokenize",
"micromark-util-types",
"micromark-util-symbol",
"micromark-util-decode-numeric-character-reference",
"hast-util-to-jsx-runtime",
"hast-util-whitespace",
"hast-util-from-parse5",
"property-information",
"space-separated-tokens",
"comma-separated-tokens",
"decode-named-character-reference",
"character-entities",
"unist-util-position",
"unist-util-stringify-position",
"unist-util-visit",
"unist-util-is",
],
typescript: {
ignoreBuildErrors: true,
},
};
export default nextConfig;