import path from "node:path"; import type { NextConfig } from "next"; const nextConfig: NextConfig = { // A SECOND dev server for the e2e suite, alongside the one being used. // // Next 16 refuses to start a second `next dev` for the same project and says // so instead of listening -- so with a dev server open on 3050, every spec // failed with ERR_CONNECTION_REFUSED and nothing in the Playwright output // pointed at the cause. The lock lives under the build directory, so giving // the suite its own is enough to let both run. Judging clips and running the // tests at the same time is the normal case here, not an edge one. distDir: process.env.NEXT_DIST_DIR ?? ".next", // lmdb is a NATIVE module and must be required at runtime, not bundled. // // Bundling it makes Turbopack try to resolve `moduleRequire('cbor-x')` -- an // OPTIONAL dependency lmdb only reaches when an encoding asks for it -- and // fail the whole module graph. Every page importing lib/projects then 500s // with "Can't resolve 'cbor-x'", which names a package nothing here uses. serverExternalPackages: ["lmdb"], // No route's trace may list the e2e fixture (.e2e-song, where // e2e/fixtures/make-fixture.mjs links the song data; .e2e-song-media, the // storage spec's media root), the e2e server's own // build directory (.next-e2e) or an env file: none is a run-time input. The // clip-audio route's trace listed 1,704 such files (plans/release-15.md, slice // UT). That was fixed at the call (lib/paths.mjs `cacheFile`); this is the // second line, measured on its own: with the old route it takes the trace // back to what the sibling routes list. scripts/next-build-trace.test.mjs // reads the last build's traces back. outputFileTracingExcludes: { "/*": ["./.e2e-song/**/*", "./.e2e-song-media/**/*", "./.next-e2e/**/*", "./.env*"], }, turbopack: { // Same reasoning as editor/next.config.ts: Turbopack infers the workspace // root by walking up for the outermost lockfile, and a stray pnpm-lock.yaml // above the checkout silently relocates it. Nothing here lives above the // monorepo root, so pinning it costs nothing. root: path.join(__dirname, ".."), // Silences the "whole project was traced unintentionally" warning, and only // it (path + title), for one measured reason: 66 of the 68 routes trace // umtool's own tree, its 361 files outside dot-directories, next.config.ts // (the file the warning names) among them. A path or fs call on a value // Turbopack cannot know (an env var, the home directory, a parameter) is a // pattern over the project, and umtool has hundreds. Opting out every path // op in the three path modules left 31 of the 68 routes clean; opting out // all 319 in the 53 modules that have one left 49 clean, and the rest come // through fs calls (lib/report/snapshots.mjs, among others). That walk skips // dot-directories and does not enter symlinks, and the traces are not // consumed while `output: "standalone"` stays off. The warning cannot tell // that walk from one that does reach a dot-directory (both name // next.config.ts), so that case is excluded above and checked after the // build by scripts/next-build-trace.test.mjs instead. ignoreIssue: [ { path: "**/next.config.ts", title: "Encountered unexpected file in NFT list", }, ], }, }; export default nextConfig;