Add PocketBase login, first-sign-in password changes, account settings, and user activation, reactivation and deletion with self-removal guards. Protect application pages and APIs and keep private pages out of PWA caches. Resolve plant locations from site assignments and improve map controls, profit chart views, navigation and mobile table layouts. Validation: production build and TypeScript passed; 28 unit tests passed. Backend access integration tests and mobile verification are documented.
47 lines
2.2 KiB
TypeScript
47 lines
2.2 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import withPWAInit from "@ducanh2912/next-pwa";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// No `env` block — NEXT_PUBLIC_ vars are picked up automatically at build time.
|
|
|
|
// Next.js blocks dev resources (HMR client, font optimizer, stack frames) for
|
|
// any origin that isn't localhost. When you open the dev server from another
|
|
// device on the LAN, the SSR HTML renders but /_next/hmr is refused, so the
|
|
// page never hydrates and every button/control is inert.
|
|
//
|
|
// Patterns are matched per dot-segment with `*` as a single-segment wildcard
|
|
// (same rules as `images.remotePatterns`) — CIDR ranges do NOT work here.
|
|
// Dev-only; `allowedDevOrigins` has no effect on `next build` / `next start`.
|
|
allowedDevOrigins: ["192.168.0.*", "100.88.155.*", "*.local"],
|
|
|
|
// Emits `.next/standalone/server.js` with a trimmed node_modules, so the
|
|
// runtime image doesn't need the full dependency tree. Required by the
|
|
// Dockerfile. Note it does NOT bundle `.next/static` or `public/` — the
|
|
// Dockerfile copies those in separately.
|
|
output: "standalone",
|
|
|
|
// pdfjs-dist dynamically imports its own worker module at runtime. When Next bundles
|
|
// it, that import is rewritten to a path inside .next that does not exist in the
|
|
// standalone image, and every parse dies with "Setting up fake worker failed".
|
|
// Keeping it external means it is required from node_modules at runtime and traced
|
|
// into the image, so the worker resolves next to the library that needs it.
|
|
serverExternalPackages: ["pdfjs-dist"],
|
|
};
|
|
|
|
const withPWA = withPWAInit({
|
|
dest: "public",
|
|
// Off in dev. next-pwa writes sw.js + workbox-*.js into `dest` on every
|
|
// compile, and the dev server watches public/ — so leaving it on makes each
|
|
// build trigger the next one, forever. A dev service worker also serves
|
|
// stale assets against HMR. Production builds are unaffected.
|
|
disable: process.env.NODE_ENV === "development",
|
|
cacheStartUrl: false,
|
|
dynamicStartUrl: false,
|
|
cacheOnFrontEndNav: false,
|
|
aggressiveFrontEndNavCaching: false,
|
|
reloadOnOnline: true,
|
|
register: true,
|
|
workboxOptions: { runtimeCaching: [], cleanupOutdatedCaches: true, clientsClaim: true, skipWaiting: true },
|
|
});
|
|
|
|
export default withPWA(nextConfig);
|