forked from saleor/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
90 lines (85 loc) 路 2.41 KB
/
Copy pathnext.config.ts
File metadata and controls
90 lines (85 loc) 路 2.41 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
import withBundleAnalyzerConfig from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";
import { type NextConfig } from "next";
// cache request for 1 day (in seconds) + revalidate once 60 seconds
const cacheValue = "private,s-maxage=60,stale-while-revalidate=86400";
const nextConfig: NextConfig = {
async headers() {
return [
{
source: "/api/trpc/clientLogs.getByCheckoutOrOrderId",
// Keys based on https://vercel.com/docs/edge-network/headers/cache-control-headers
headers: [
{
key: "CDN-Cache-Control",
value: cacheValue,
},
{
key: "Cache-Control",
value: cacheValue,
},
],
},
{
source: "/api/trpc/clientLogs.getByDate",
headers: [
{
key: "CDN-Cache-Control",
value: cacheValue,
},
{
key: "Cache-Control",
value: cacheValue,
},
],
},
];
},
reactStrictMode: true,
transpilePackages: [
"@saleor/apps-otel",
"@saleor/apps-logger",
"@saleor/apps-shared",
"@saleor/apps-ui",
"@saleor/react-hook-form-macaw",
],
experimental: {
optimizePackageImports: [
"@sentry/nextjs",
"@sentry/node",
"usehooks-ts",
"@saleor/app-sdk",
"@trpc/server",
"@trpc/client",
"@trpc/react-query",
"@trpc/next",
"jotai",
],
},
bundlePagesRouterDependencies: true,
serverExternalPackages: [
"@aws-sdk/client-dynamodb",
"@aws-sdk/lib-dynamodb",
"@aws-sdk/util-dynamodb",
"dynamodb-toolbox",
],
webpack: (config, { isServer }) => {
if (isServer) {
// Ignore opentelemetry warnings - https://github.com/open-telemetry/opentelemetry-js/issues/4173
config.ignoreWarnings = [{ module: /require-in-the-middle/ }];
}
return config;
},
};
const configWithBundleAnalyzer = withBundleAnalyzerConfig({
enabled: process.env.ANALYZE_BUNDLE === "true",
})(nextConfig);
// Make sure to export sentry config as the last one - https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#apply-instrumentation-to-your-app
export default withSentryConfig(configWithBundleAnalyzer, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
silent: true,
disableLogger: true,
widenClientFileUpload: true,
tunnelRoute: "/monitoring",
});