-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnext.config.ts
More file actions
51 lines (47 loc) · 1.16 KB
/
next.config.ts
File metadata and controls
51 lines (47 loc) · 1.16 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
import setMDX from '@next/mdx';
import { NextConfig } from 'next';
import setPWA from 'next-pwa';
// @ts-expect-error no official types
import withLess from 'next-with-less';
const { NODE_ENV, CI } = process.env;
const isDev = NODE_ENV === 'development';
const withMDX = setMDX({
options: {
remarkPlugins: [],
rehypePlugins: [],
providerImportSource: '@mdx-js/react',
},
extension: /\.mdx?$/,
}),
withPWA = setPWA({
dest: 'public',
register: true,
skipWaiting: true,
disable: isDev,
});
const rewrites: NextConfig['rewrites'] = async () => ({
beforeFiles: [
{
source: '/proxy/github.com/:path*',
destination: 'https://github.com/:path*',
},
{
source: '/proxy/raw.githubusercontent.com/:path*',
destination: 'https://raw.githubusercontent.com/:path*',
},
{
source: '/proxy/geo.datav.aliyun.com/:path*',
destination: 'https://geo.datav.aliyun.com/:path*',
},
],
afterFiles: [],
});
export default withPWA(
withLess(
withMDX({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
output: CI ? 'standalone' : undefined,
rewrites,
}),
),
);