WFDASH-WEBAPP/next.config.ts
Dave 43de97501c feat(tv): add TV dashboard + refine workflows
Add full PIN-protected TV dashboard stack including auth, redirects, map view, APIs, and server services.

Also include these critical refinements:
- Overhaul PO number generation to use per-company monthly sequences
- Rework quote rejection to bounce quotes back to operator queues instead of marking them terminal
- Add post_processing order tab group for clearer workflow visibility
- Fix collection pool tooltip positioning, overflow clipping, and default collapsed state
- Refactor customer list API, clean up unused form props, and fix item intel popover target ID handling
- Add comprehensive tests for new components and update existing test expectations
2026-08-13 20:55:22 +02:00

39 lines
2.2 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
// Server-only deps we don't want webpack to touch. Both pdf-parse and
// its transitive pdfjs-dist use ES2022 features + top-level `__esModule`
// marker that webpack's RSC runtime chokes on
// ("Object.defineProperty called on non-object"). Marking them external
// means Node resolves them at runtime from node_modules instead of going
// through webpack's loader — so pdfjs-dist's init runs in a clean CJS
// context, the way its author expects.
serverExternalPackages: ["pdf-parse", "pdfjs-dist", "@napi-rs/canvas"],
// Dev server blocks cross-origin HMR requests by default in Next 16. The
// app is normally loaded on `localhost`, but we also load it on
// `127.0.0.1` (and on the LAN IP for phone testing). Listing both keeps
// the HMR client from hanging on the first load.
allowedDevOrigins: ["127.0.0.1", "localhost", "192.168.1.42", "192.168.1.122", "192.168.1.128", "coolify.mywire.org", "*"],
// The agent (and any external tools) sometimes reach for the PocketBase
// collection name verbatim — `order_items`, `stock_items`, `quote_items`
// — and get a 404 because the route folders use hyphens (`order-items`).
// Redirect the underscore variants to the hyphenated route so the agent
// stops confusing the PB collection name with the URL path.
async redirects() {
return [
{ source: "/api/v1/order_items", destination: "/api/v1/order-items", permanent: true },
{ source: "/api/v1/stock_items", destination: "/api/v1/stock-items", permanent: true },
{ source: "/api/v1/quote_items", destination: "/api/v1/quote-items", permanent: true },
{ source: "/api/v1/stock_purchases", destination: "/api/v1/stock-purchases", permanent: true },
{ source: "/api/v1/stock_quick_draft", destination: "/api/v1/stock-quick-draft", permanent: true },
// Counter PWA shortcut — keeps the install URL short.
{ source: "/counter", destination: "/new-order", permanent: true },
// TV dashboard shortcut — /tv → /pin (which itself bounces
// to /dashboard once the cookie is valid).
{ source: "/tv", destination: "/pin", permanent: true },
];
},
};
export default nextConfig;