Repository navigation
Expand file tree
/
Copy pathnext.config.js
More file actions
101 lines (94 loc) · 2.52 KB
/
Copy pathnext.config.js
File metadata and controls
101 lines (94 loc) · 2.52 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
const LEARN_DEST = 'https://learnvibecoding.vercel.app';
// All learnvibecoding page routes to proxy
const LEARN_PAGE_ROUTES = [
'/curriculum/:path*',
'/concepts/:path*',
'/quiz/:path*',
'/quiz-chat/:path*',
'/discover',
'/voice/:path*',
'/skill-map',
'/claude-code/:path*',
'/journey/:path*',
'/connect',
'/physicsdemo/:path*',
'/teams/:path*',
'/dashboard/:path*',
'/sessions/:path*',
'/know-yourself/:path*',
'/workflow/:path*',
'/build/:path*',
'/debugging/:path*',
'/shipping/:path*',
'/enlightenment/:path*',
'/first-build',
'/for-developers',
'/for-your-role',
'/strategy',
'/level-up',
'/join/:slug',
];
// All learnvibecoding API routes to proxy
const LEARN_API_ROUTES = [
'/api/chat/:path*',
'/api/quiz-chat/:path*',
'/api/physics-chat/:path*',
'/api/physics-quiz-chat/:path*',
'/api/physics-sessions/:path*',
'/api/teams/:path*',
'/api/cv-auth/:path*',
];
// Static assets
const LEARN_STATIC_ROUTES = [
'/textures/:path*',
];
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: ['vercel.app', 'codevibinggallery.vercel.app'],
},
async redirects() {
return [
{ source: '/physics', destination: '/c/physics', permanent: false },
{ source: '/learnvibecoding', destination: '/c/learnvibecoding', permanent: false },
];
},
async rewrites() {
// For routes with :path*, add both exact and wildcard variants
// because :path* doesn't match the bare path (e.g. /curriculum)
const allSources = [
...LEARN_PAGE_ROUTES,
...LEARN_API_ROUTES,
...LEARN_STATIC_ROUTES,
];
const learnRewrites = [];
for (const source of allSources) {
if (source.endsWith('/:path*')) {
const base = source.replace('/:path*', '');
learnRewrites.push(
{ source: base, destination: `${LEARN_DEST}${base}` },
{ source, destination: `${LEARN_DEST}${source}` },
);
} else if (source.endsWith('/:slug')) {
learnRewrites.push({ source, destination: `${LEARN_DEST}${source}` });
} else {
learnRewrites.push({ source, destination: `${LEARN_DEST}${source}` });
}
}
return {
afterFiles: learnRewrites,
};
},
webpack: (config, { isServer }) => {
if (isServer) {
// Ignore pdf-parse test files during build
config.externals = config.externals || [];
config.externals.push({
'canvas': 'commonjs canvas',
});
}
return config;
},
};
module.exports = nextConfig;