-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathnext.config.mjs
More file actions
59 lines (52 loc) · 1.38 KB
/
next.config.mjs
File metadata and controls
59 lines (52 loc) · 1.38 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
/** @type {import("next").NextConfig} */
const nextConfig = {
// Disable React running twice as it messes up with iframes
reactStrictMode: false,
typedRoutes: true,
// Configure asset prefix for CDN or subdirectory support
assetPrefix: process.env.ASSET_PREFIX || undefined,
// Configure image domains for Next.js Image component
images: {
remotePatterns: [
{
protocol: "https",
hostname: "www.archive.org",
},
],
},
// Turbopack configuration
turbopack: {
rules: {
// Handle SVG imports with ?url as file URLs
"*.svg?url": {
loaders: ["file-loader"],
as: "*.svg",
},
// Handle all other SVG imports as React components
"*.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
async redirects() {
const isProduction = process.env.NODE_ENV === "production";
const isManifestEnabled = !isProduction || process.env.MANIFEST_ROUTE_FORCE_ENABLE === "true";
const redirects = [
{
source: "/read/experimental/:identifier",
destination: "/read/:identifier",
permanent: true,
},
];
if (isProduction && !isManifestEnabled) {
redirects.push({
source: "/read/manifest/:path*",
destination: "/",
permanent: false,
});
}
return redirects;
}
};
export default nextConfig;