-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.ts
More file actions
150 lines (129 loc) · 4.09 KB
/
Copy pathnext.config.ts
File metadata and controls
150 lines (129 loc) · 4.09 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import { withSentryConfig } from '@sentry/nextjs';
import type { NextConfig } from "next";
import createNextIntlPlugin from 'next-intl/plugin';
import packageJson from './package.json';
const withNextIntl = createNextIntlPlugin('./i18n/request.ts');
const externalPackages = [
'node-pty',
'better-sqlite3',
'drizzle-orm',
'@earendil-works/pi-ai',
'@earendil-works/pi-agent-core',
'@eigenpal/docx-js-editor',
'pdf-parse',
'file-type',
'@hocuspocus/server',
'@hocuspocus/transformer',
'@tiptap/y-tiptap',
'y-prosemirror',
'y-protocols',
'yjs',
];
const sentryTunnelRoute = process.env.SENTRY_TUNNEL_ROUTE?.trim() || undefined;
const deploymentId = (
process.env.NEXT_DEPLOYMENT_ID?.trim() || `canvas-notebook-${packageJson.version}`
).replace(/[^A-Za-z0-9_-]/g, '-');
const allowedDevOrigins = process.env.NEXT_ALLOWED_DEV_ORIGINS
? process.env.NEXT_ALLOWED_DEV_ORIGINS.split(',').map(o => o.trim()).filter(Boolean)
: [];
const nextConfig: NextConfig = {
deploymentId,
...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
onDemandEntries: {
maxInactiveAge: 30_000,
pagesBufferLength: 3,
},
// Wichtig für native Server-Pakete: Als external markieren im Server Bundle
webpack: (config, { isServer }) => {
if (isServer) {
config.externals.push(...externalPackages);
}
return config;
},
serverExternalPackages: externalPackages,
outputFileTracingExcludes: {
'/*': ['./data/**/*'],
'/api/files/download': ['./data/**/*', './next.config.ts'],
},
turbopack: {
ignoreIssue: [
{
path: /next\.config\.ts$/,
title: /Encountered unexpected file in NFT list/,
description: /whole project was traced unintentionally/,
},
],
},
poweredByHeader: false,
compress: true,
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'X-Robots-Tag',
value: 'noindex, nofollow, noarchive, nosnippet, noimageindex, notranslate',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
],
},
];
},
async rewrites() {
return [
// Redirect old /media/* URLs to /api/media/* for backward compatibility
{
source: '/media/:path*',
destination: '/api/media/:path*',
},
];
},
// Experimental features
experimental: {
serverActions: {
bodySizeLimit: '10mb', // Für File Uploads
},
// Required when proxy/middleware is enabled; otherwise multipart uploads are truncated at 10MB.
proxyClientMaxBodySize: '256mb',
},
};
const sentryOptions = {
// For all available options, see:
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
org: "canvas-holdings",
project: "canvas-notebook",
// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Keep the Sentry tunnel opt-in. The default container path should not route browser
// telemetry back through Next.js because it adds avoidable startup log noise.
...(sentryTunnelRoute ? { tunnelRoute: sentryTunnelRoute } : {}),
webpack: {
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
// Tree-shaking options for reducing bundle size
treeshake: {
// Automatically tree-shake Sentry logger statements to reduce bundle size
removeDebugLogging: true,
},
},
};
export default withSentryConfig(withNextIntl(nextConfig), sentryOptions);