-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnext.config.js
59 lines (50 loc) · 1.57 KB
/
next.config.js
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
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
// Whether to generate and upload production source maps
const ENABLE_SOURCE_MAPS = process.env.RENDER === 'true'
module.exports = (phase, { defaultConfig }) => {
let config = {
...defaultConfig,
// Enable browser source map generation during the production build
// on Render (i.e. not when building locally, for speed reasons)
productionBrowserSourceMaps: ENABLE_SOURCE_MAPS,
env: {
// These are exposed in the client bundle
HOSTNAME: process.env.HOSTNAME,
IS_PULL_REQUEST: process.env.IS_PULL_REQUEST,
PORT: process.env.PORT,
RENDER_EXTERNAL_HOSTNAME: process.env.RENDER_EXTERNAL_HOSTNAME,
RENDER_GIT_COMMIT: process.env.RENDER_GIT_COMMIT,
RENDER: process.env.RENDER
},
eslint: {
// Don't run eslint during `next build`
ignoreDuringBuilds: true
},
// Disable Next.js "x-powered-by" header
poweredByHeader: false,
// Enable React strict mode
reactStrictMode: true,
redirects: async () => [
{
source: '/buy',
destination: 'https://lu.ma/speakeasyjs',
permanent: false
},
{
source: '/talks',
destination: '/',
permanent: true
}
]
}
if (phase === PHASE_DEVELOPMENT_SERVER) {
return config
} else {
if (process.env.ANALYZE === 'true') {
const BundleAnalyzer = require('@next/bundle-analyzer')
const withBundleAnalyzer = BundleAnalyzer({ enabled: true })
config = withBundleAnalyzer(config)
}
return config
}
}