forked from mfts/papermark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
88 lines (82 loc) · 2.25 KB
/
next.config.mjs
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
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
pageExtensions: ["js", "jsx", "ts", "tsx", "mdx"],
images: {
minimumCacheTTL: 2592000, // 30 days
remotePatterns: prepareRemotePatterns(),
},
transpilePackages: ["@trigger.dev/react"],
skipTrailingSlashRedirect: true,
experimental: {
outputFileTracingIncludes: {
"/api/mupdf/*": ["./node_modules/mupdf/lib/*.wasm"],
},
missingSuspenseWithCSRBailout: false,
},
async redirects() {
return [
{
source: "/view/d/:path*",
destination: "/view/:path*",
permanent: true,
},
];
},
async rewrites() {
return [
{
source: "/ai-pitch-deck-generator/:path*",
destination: "https://deck.papermark.io/:path*",
},
];
},
};
function prepareRemotePatterns() {
let patterns = [
// static images and videos
{ protocol: "https", hostname: "assets.papermark.io" },
// twitter img
{ protocol: "https", hostname: "pbs.twimg.com" },
// linkedin img
{ protocol: "https", hostname: "media.licdn.com" },
// google img
{ protocol: "https", hostname: "lh3.googleusercontent.com" },
// papermark img
{ protocol: "https", hostname: "www.papermark.io" },
// special document pages
{ protocol: "https", hostname: "d36r2enbzam0iu.cloudfront.net" },
// blog images
{
protocol: "https",
hostname: "aicontentfy-customer-images.s3.eu-central-1.amazonaws.com",
},
// also blog images
{ protocol: "https", hostname: "dev-to-uploads.s3.amazonaws.com" },
];
if (process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST) {
patterns.push({
protocol: "https",
hostname: process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST,
});
}
if (process.env.VERCEL_ENV === "production") {
patterns.push({
// production vercel blob
protocol: "https",
hostname: "yoywvlh29jppecbh.public.blob.vercel-storage.com",
});
}
if (
process.env.VERCEL_ENV === "preview" ||
process.env.NODE_ENV === "development"
) {
patterns.push({
// staging vercel blob
protocol: "https",
hostname: "36so9a8uzykxknsu.public.blob.vercel-storage.com",
});
}
return patterns;
}
export default nextConfig;