-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathnext.config.ts
38 lines (32 loc) · 864 Bytes
/
next.config.ts
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
import type { NextConfig } from 'next';
import createMDX from '@next/mdx';
import postgres from 'postgres';
export const sql = postgres(process.env.POSTGRES_URL!, {
ssl: 'allow'
});
const nextConfig: NextConfig = {
pageExtensions: ['mdx', 'ts', 'tsx'],
async redirects() {
if (!process.env.POSTGRES_URL) {
return [];
}
let redirects = await sql`
SELECT source, destination, permanent
FROM redirects;
`;
return redirects.map(({ source, destination, permanent }) => ({
source,
destination,
permanent: !!permanent
}));
},
// Note: Using the Rust compiler means we cannot use
// rehype or remark plugins. For my app, this is fine.
experimental: {
mdxRs: true,
viewTransition: true,
newDevOverlay: true
}
};
const withMDX = createMDX({});
export default withMDX(nextConfig);