forked from umami-software/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
93 lines (85 loc) · 2.42 KB
/
next.config.mjs
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
import remarkGfm from 'remark-gfm';
import createMDX from '@next/mdx';
import { withAxiom } from 'next-axiom';
import rehypeHighlight from 'rehype-highlight';
import path from 'path';
const withMDX = createMDX({
options: {
extension: /\.mdx?$/,
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypeHighlight],
// If you use `MDXProvider`, uncomment the following line.
// providerImportSource: "@mdx-js/react",
},
});
const headers = [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
];
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
mdxRs: false,
},
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
reactStrictMode: false,
output: 'standalone',
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
webpack(config) {
const fileLoaderRule = config.module.rules.find(rule => rule.test?.test?.('.svg'));
config.module.rules.push(
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/,
},
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] },
use: ['@svgr/webpack'],
},
);
fileLoaderRule.exclude = /\.svg$/i;
config.resolve.alias['public'] = path.resolve('./public');
return config;
},
async headers() {
return [
{
source: '/:path*',
headers,
},
];
},
async rewrites() {
return [
{ source: '/docs/getting-started', destination: '/docs' },
{ source: '/a/script.js', destination: 'https://analytics.eu.umami.is/script.js' },
{ source: '/discord', destination: 'https://discord.gg/4dz4zcXYrQ' },
{ source: '/analytics', destination: '/lp/analytics' },
{ source: '/website-analytics', destination: '/lp/website-analytics' },
{
source: '/open-source-website-analytics',
destination: '/lp/open-source-website-analytics',
},
{ source: '/privacy-analytics', destination: '/lp/privacy-analytics' },
{ source: '/linkedin', destination: '/lp/linkedin' },
{ source: '/reddit', destination: '/lp/reddit' },
{ source: '/apollo', destination: '/lp/apollo' },
{ source: '/apollo-ga', destination: '/lp/google-analytics' },
];
},
};
export default withAxiom(withMDX(nextConfig));