All checks were successful
Deploy to VPS / deploy (push) Successful in 1m10s
pdf-parse v2 depends on @napi-rs/canvas (native module) which fails in Next.js standalone Docker builds — native binaries aren't traced/copied to the standalone output, causing DOMMatrix is not defined at runtime. Replaced pdf-parse entirely with pdfjs-dist legacy build which works natively in Node.js without canvas or DOM API dependencies: - New src/lib/pdf.ts: extractTextFromPdf() using pdfjs-dist/legacy/build - Worker file explicitly imported so Next.js file tracer includes it - Updated all call sites: documents, norms/parse, contracts - Removed pdf-parse from dependencies, added pdfjs-dist directly - Changed serverExternalPackages from pdf-parse to pdfjs-dist Verified: build succeeds, both pdf.mjs and pdf.worker.mjs present in .next/standalone, text extraction works in standalone context. Co-Authored-By: Paperclip <noreply@paperclip.ing>
21 lines
434 B
TypeScript
21 lines
434 B
TypeScript
import type { NextConfig } from "next";
|
|
import { execSync } from "child_process";
|
|
|
|
const commitHash = (() => {
|
|
try {
|
|
return execSync("git rev-parse --short HEAD").toString().trim();
|
|
} catch {
|
|
return "dev";
|
|
}
|
|
})();
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
serverExternalPackages: ["pdfjs-dist", "drizzle-orm", "pg"],
|
|
env: {
|
|
NEXT_PUBLIC_BUILD_HASH: commitHash,
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|