0.2 在线版本打通
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
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,
|
||||
@@ -9,6 +12,18 @@ const nextConfig: NextConfig = {
|
||||
// 说明:ONLYOFFICE 文档服务器会在其 iframe 内跨域拉取插件 manifest/js/html。
|
||||
// 这里对插件资源放开 CORS,避免 pluginsData 加载失败。
|
||||
return [
|
||||
// 说明:远程通过 Cloudflare Tunnel 访问时,Next.js(Turbopack dev)默认对
|
||||
// `/_next/static/chunks/*` 返回 `no-store`,导致 Cloudflare 无法缓存大体积
|
||||
// bundle,网络稍慢时会出现页面长期停留在“正在载入编辑器...”的现象。
|
||||
// 这些资源带 hash 文件名,设置 immutable 不会导致更新不一致。
|
||||
{
|
||||
source: "/_next/static/chunks/:path*",
|
||||
headers: [{ key: "Cache-Control", value: "public, max-age=31536000, immutable" }],
|
||||
},
|
||||
{
|
||||
source: "/_next/static/media/:path*",
|
||||
headers: [{ key: "Cache-Control", value: "public, max-age=31536000, immutable" }],
|
||||
},
|
||||
{
|
||||
source: "/onlyoffice/plugins/:path*",
|
||||
headers: [
|
||||
|
||||
Reference in New Issue
Block a user