-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnext.config.js
More file actions
56 lines (52 loc) · 1.61 KB
/
next.config.js
File metadata and controls
56 lines (52 loc) · 1.61 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
51
52
53
54
55
56
const paybuttonConfig = require('./paybutton-config.json')
const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
PHASE_PRODUCTION_SERVER,
} = require('next/constants')
// This uses phases as outlined here: https://nextjs.org/docs/#custom-configuration
module.exports = (phase) => {
// when started in development mode `next dev` or `npm run dev` regardless of the value of STAGING environmental variable
const isDev = phase === PHASE_DEVELOPMENT_SERVER
// when `next build` or `npm run build` is used
const isBuild = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1'
// when `next start` or `npm run start` is used
const isProd = phase === PHASE_PRODUCTION_SERVER
// when `next build` or `npm run build` is used
const isStaging =
phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1'
const branch = process.env.BRANCH || 'master'
console.log(`branch: ${branch}\nisDev:${isDev} isBuild:${isBuild} isProd:${isProd} isStaging:${isStaging}`)
return {
outputFileTracing: true,
eslint: {
ignoreDuringBuilds: true
},
typescript: {
ignoreBuildErrors: true
},
async headers () {
return [
{
source: '/(.*)',
headers: [
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'Content-Security-Policy', value: "frame-ancestors 'none'" },
],
},
]
},
async rewrites () {
return [
{
source: '/:path*',
destination: '/:path*',
},
{
source: '/:path*',
destination: `/api/:path*`,
},
]
},
}
}