import type { NextConfig } from "next"; const nextConfig: NextConfig = { 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;