generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 5
/
next.config.mjs
40 lines (36 loc) · 995 Bytes
/
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
import { withSentryConfig } from '@sentry/nextjs';
import setPWA from 'next-pwa';
// @ts-ignore
import withLess from 'next-with-less';
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 nextConfig = withLess(
withPWA({
output: CI ? 'standalone' : undefined,
webpack: config => {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/^node:/, resource => {
resource.request = resource.request.replace(/^node:/, '');
}),
);
return config;
},
}),
);
export default isDev || !SENTRY_AUTH_TOKEN
? nextConfig
: withSentryConfig(nextConfig, {
autoInstrumentServerFunctions: false,
org: SENTRY_ORG,
project: SENTRY_PROJECT,
authToken: SENTRY_AUTH_TOKEN,
silent: true,
});