-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnext.config.ts
More file actions
50 lines (45 loc) · 1.2 KB
/
next.config.ts
File metadata and controls
50 lines (45 loc) · 1.2 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
import { NextConfig } from 'next';
// @ts-expect-error Upstream has no type package
import withLess from 'next-with-less';
import setPWA from 'next-pwa';
import WP from 'webpack';
const { NODE_ENV, CI } = process.env;
const withPWA = setPWA({
dest: 'public',
register: true,
skipWaiting: true,
disable: NODE_ENV === 'development',
});
const webpack: NextConfig['webpack'] = config => {
config.plugins.push(
new WP.NormalModuleReplacementPlugin(/^node:/, resource => {
resource.request = resource.request.replace(/^node:/, '');
}),
);
return config;
};
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: [],
fallback: [],
});
/** @type {import('next').NextConfig} */
export default withLess(
withPWA({
reactStrictMode: true,
output: CI ? 'standalone' : undefined,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
transpilePackages: ['@sentry/browser'],
webpack,
rewrites,
}),
);