forked from payloadcms/payload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
67 lines (61 loc) · 1.62 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
import bundleAnalyzer from '@next/bundle-analyzer'
import { withSentryConfig } from '@sentry/nextjs'
import { withPayload } from './packages/next/src/withPayload.js'
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(__filename)
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})
const config = withBundleAnalyzer(
withPayload({
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
experimental: {
serverActions: {
bodySizeLimit: '5mb',
},
},
env: {
PAYLOAD_CORE_DEV: 'true',
ROOT_DIR: path.resolve(dirname),
},
async redirects() {
return [
{
destination: '/admin',
permanent: true,
source: '/',
},
]
},
images: {
domains: ['localhost'],
},
webpack: (webpackConfig) => {
webpackConfig.resolve.extensionAlias = {
'.cjs': ['.cts', '.cjs'],
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.mjs': ['.mts', '.mjs'],
}
// Ignore sentry warnings when not wrapped with withSentryConfig
webpackConfig.ignoreWarnings = [
...(webpackConfig.ignoreWarnings ?? []),
{ file: /esm\/platform\/node\/instrumentation.js/ },
{ module: /esm\/platform\/node\/instrumentation.js/ },
]
return webpackConfig
},
}),
)
export default process.env.NEXT_PUBLIC_SENTRY_DSN
? withSentryConfig(config, {
telemetry: false,
tunnelRoute: '/monitoring-tunnel',
})
: config