-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathnext.config.ts
More file actions
59 lines (56 loc) · 2.22 KB
/
Copy pathnext.config.ts
File metadata and controls
59 lines (56 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
output: process.env.VERCEL ? undefined : 'standalone',
outputFileTracingIncludes: {
'/*': [
'lib/server/agent-runtime/import-pptx-worker.mjs',
'skills/openmaic/**',
'skills/agent-runtime/**',
],
},
typescript: {
tsconfigPath: process.env.NODE_ENV === 'production' ? 'tsconfig.build.json' : 'tsconfig.json',
},
transpilePackages: ['mathml2omml', 'pptxgenjs', '@openmaic/importer'],
// These agent packages do a runtime `import(specifier)` with a computed
// specifier (to lazily load node:fs/os/path without breaking browser/Vite
// builds). webpack can't statically analyze that and bundling it throws
// "Cannot find module as expression is too dynamic" at runtime on the server
// (the "Edit with AI" Pro-mode path), which broke the #619 keep-alive e2e.
// Mark them server-external so Next loads them natively and the dynamic
// import resolves as a real Node call.
serverExternalPackages: [
'@earendil-works/pi-ai',
'@earendil-works/pi-agent-core',
'@openmaic/generation',
// Optional peers of @openmaic/storage, reached through deliberately
// untraced dynamic imports. Externalizing keeps them out of the bundle,
// and the static anchor in lib/persistence/asset-byte-store.ts gets them
// traced into the standalone image -- without it, S3 mode and redirect
// egress cannot resolve their SDK in the shipped deployment.
'@aws-sdk/client-s3',
'@aws-sdk/s3-request-presigner',
],
experimental: {
proxyClientMaxBodySize: '200mb',
},
async headers() {
const extraAncestors = process.env.ALLOWED_FRAME_ANCESTORS?.trim();
const frameAncestors = extraAncestors ? `'self' ${extraAncestors}` : "'self'";
return [
{
source: '/(.*)',
headers: [
// X-Frame-Options only supports SAMEORIGIN (no allow-list),
// so we omit it when custom ancestors are configured.
...(!extraAncestors ? [{ key: 'X-Frame-Options', value: 'SAMEORIGIN' }] : []),
{
key: 'Content-Security-Policy',
value: `frame-ancestors ${frameAncestors}`,
},
],
},
];
},
};
export default nextConfig;