Files
next-ai-draw-io/next.config.ts
T

51 lines
1.7 KiB
TypeScript
Raw Normal View History

import type { NextConfig } from "next"
import packageJson from "./package.json"
const nextConfig: NextConfig = {
/* config options here */
output: "standalone",
// Keep the dev badge clear of the chat panel (right) and the page tabs
// (bottom left)
devIndicators: { position: "top-left" },
// Support for subdirectory deployment (e.g., https://example.com/nextaidrawio)
// Set NEXT_PUBLIC_BASE_PATH environment variable to your subdirectory path (e.g., /nextaidrawio)
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "",
env: {
APP_VERSION: packageJson.version,
},
// The bundled draw.io shares the app's origin (and its stored keys):
// only the app may put it in a frame
async headers() {
return [
{
source: "/drawio/:path*",
headers: [
{
key: "Content-Security-Policy",
value: "frame-ancestors 'self'",
},
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
],
},
]
},
// Include instrumentation.ts in standalone build for Langfuse telemetry,
// and the shape library docs get_shape_library reads at run time
outputFileTracingIncludes: {
"*": ["./instrumentation.ts"],
"/api/chat": ["./docs/shape-libraries/*.md"],
},
}
export default nextConfig
// Initialize OpenNext Cloudflare for local development only
// This must be a dynamic import to avoid loading workerd binary during builds
if (process.env.NODE_ENV === "development") {
import("@opennextjs/cloudflare").then(
({ initOpenNextCloudflareForDev }) => {
initOpenNextCloudflareForDev()
},
)
}