-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnext.config.ts
More file actions
59 lines (54 loc) · 1.55 KB
/
next.config.ts
File metadata and controls
59 lines (54 loc) · 1.55 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
import { withSentryConfig } from '@sentry/nextjs';
import { NextConfig } from 'next';
import setPWA from 'next-pwa';
import webpack from 'webpack';
const { NODE_ENV, CI, SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT } = process.env;
const isDev = NODE_ENV === 'development';
const 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*',
},
],
afterFiles: [],
});
const nextConfig = withPWA({
output: CI ? 'standalone' : undefined,
compiler: {
emotion: true,
},
images: {
remotePatterns: [{ protocol: 'https', hostname: 'github.com' }],
},
webpack: config => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/^node:/, resource => {
resource.request = resource.request.replace(/^node:/, '');
}),
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return config;
},
rewrites,
});
export default isDev || !SENTRY_AUTH_TOKEN
? nextConfig
: withSentryConfig(nextConfig, {
autoInstrumentServerFunctions: false,
org: SENTRY_ORG,
project: SENTRY_PROJECT,
authToken: SENTRY_AUTH_TOKEN,
silent: true,
});