Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
97 lines (93 loc) · 3.43 KB
/
Copy pathnext.config.ts
File metadata and controls
97 lines (93 loc) · 3.43 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
import type { NextConfig } from "next";
// The native (Capacitor) build sets NEXT_PUBLIC_BUILD_TARGET=mobile and is
// emitted as a static export into ./out, bundling all content from
// public/offline. The web build (Vercel) keeps full SSR.
const isMobile = process.env.NEXT_PUBLIC_BUILD_TARGET === "mobile";
const nextConfig: NextConfig = isMobile
? {
output: "export",
trailingSlash: true,
images: { unoptimized: true },
}
: {
// /try was a "choose a book" chooser from before the Bible was the only
// book; the page is gone but old bookmarks and crawlers may still hold
// the URL. (Export builds ignore redirects; the mobile app never linked
// to /try.)
async redirects() {
return [
{ source: "/try", destination: "/try/bible/start", permanent: true },
// Password reset went away with passwordless sign-in; old emails and
// bookmarks land on the code flow instead.
{ source: "/forgot-password", destination: "/login", permanent: true },
{ source: "/reset-password", destination: "/login", permanent: true },
];
},
// /api/search and /api/verse read the on-disk translation JSON; list the
// text directories explicitly so Vercel's file tracing bundles them with
// the functions (their paths are too dynamic to be inferred).
outputFileTracingIncludes: {
"/api/search": [
"./data/BSB/*.json",
"./data/KJV/*.json",
"./data/WEB/*.json",
"./data/ASV/*.json",
"./data/GNV/*.json",
"./data/YLT/*.json",
"./data/DBY/*.json",
"./data/JPS/*.json",
],
"/api/verse": [
"./data/BSB/*.json",
"./data/KJV/*.json",
"./data/WEB/*.json",
"./data/ASV/*.json",
"./data/GNV/*.json",
"./data/YLT/*.json",
"./data/DBY/*.json",
"./data/JPS/*.json",
],
"/api/cross-refs": [
"./data/crossrefs/*.json",
"./data/BSB/*.json",
"./data/KJV/*.json",
"./data/WEB/*.json",
"./data/ASV/*.json",
"./data/GNV/*.json",
"./data/YLT/*.json",
"./data/DBY/*.json",
"./data/JPS/*.json",
],
"/api/strongs": ["./data/strongs/*.json", "./data/lexicon/*.json"],
// The reader page and /api/chapter serve chapter text from the same
// translation JSON (src/lib/content/chapter-text.ts) instead of
// Supabase, so the reading path never waits on the database.
"/try/bible/read": [
"./data/BSB/*.json",
"./data/KJV/*.json",
"./data/WEB/*.json",
"./data/ASV/*.json",
"./data/GNV/*.json",
"./data/YLT/*.json",
"./data/DBY/*.json",
"./data/JPS/*.json",
],
"/api/chapter": [
"./data/BSB/*.json",
"./data/KJV/*.json",
"./data/WEB/*.json",
"./data/ASV/*.json",
"./data/GNV/*.json",
"./data/YLT/*.json",
"./data/DBY/*.json",
"./data/JPS/*.json",
],
},
};
// Two Next processes sharing this checkout (a dev server while `next build`
// runs, or two seats' tooling) corrupt each other through .next; set
// NEXT_DIST_DIR to give a process its own build dir.
if (process.env.NEXT_DIST_DIR) {
nextConfig.distDir = process.env.NEXT_DIST_DIR;
}
export default nextConfig;