import type { NextConfig } from "next"; const nextConfig: NextConfig = { // 供桌面端打包使用(Electron 内置 Next server.js + 最小依赖)。 // 说明:`pnpm run build:desktop:next` 会依赖该产物。 output: "standalone", turbopack: { // 避免 monorepo/多 lockfile 场景下 root 误判,减少构建与热更新的不确定性 root: __dirname, }, async headers() { // 说明:ONLYOFFICE 文档服务器会在其 iframe 内跨域拉取插件 manifest/js/html。 // 这里对插件资源放开 CORS,避免 pluginsData 加载失败。 return [ { source: "/onlyoffice/plugins/:path*", headers: [ { key: "Access-Control-Allow-Origin", value: "*" }, { key: "Access-Control-Allow-Methods", value: "GET,OPTIONS" }, { key: "Access-Control-Allow-Headers", value: "*" }, ], }, ]; }, }; export default nextConfig;