generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 15
/
next.config.mjs
55 lines (50 loc) · 1.19 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
// @ts-ignore
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',
});
/**
* @type {import('next').NextConfig['webpack']}
*/
const webpack = config => {
config.plugins.push(
new WP.NormalModuleReplacementPlugin(/^node:/, resource => {
resource.request = resource.request.replace(/^node:/, '');
}),
);
return config;
};
/**
* @type {import('next').NextConfig['rewrites']}
*/
const 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,
}),
);