import type { NextConfig } from "next"; const nextConfig: NextConfig = { transpilePackages: ["agent-core"], eslint: { ignoreDuringBuilds: true, }, experimental: { optimizePackageImports: [ "@tabler/icons-react", "lucide-react", "@radix-ui/react-icons", "recharts", "@workos-inc/node", "date-fns", "remeda", "framer-motion", ], }, // Node.js native modules that should not be bundled for edge/browser // memory-provider imports better-sqlite3 which cannot run in Cloudflare Workers serverExternalPackages: ["better-sqlite3", "./src/db/provider/memory-provider"], }; export default nextConfig; // Enable calling `getCloudflareContext()` in `next dev`. // See https://opennext.js.org/cloudflare/bindings#local-access-to-bindings. // Only init in dev -- build and lint don't need the wrangler proxy. // Disabled for local dev without Cloudflare account access: if (process.env.NODE_ENV === "development" && process.env.ENABLE_CF_DEV === "1") { import("@opennextjs/cloudflare").then((mod) => mod.initOpenNextCloudflareForDev() ); } else if (process.env.NODE_ENV === "development") { // When Cloudflare dev proxy is not enabled, set a mock context so // getCloudflareContext() doesn't throw. Actions check `env?.DB` and // gracefully return empty data when it's missing. const sym = Symbol.for("__cloudflare-context__"); (globalThis as Record)[sym] = { env: {}, // no DB binding — actions will short-circuit cf: {}, ctx: { waitUntil: () => {}, passThroughOnException: () => {} }, }; }