|
1 | 1 | const paybuttonConfig = require('./paybutton-config.json') |
2 | 2 |
|
3 | 3 | const { |
4 | | - PHASE_DEVELOPMENT_SERVER, |
5 | | - PHASE_PRODUCTION_BUILD, |
6 | | - PHASE_PRODUCTION_SERVER, |
7 | | - } = require('next/constants') |
8 | | - |
9 | | - // This uses phases as outlined here: https://nextjs.org/docs/#custom-configuration |
10 | | - module.exports = (phase) => { |
11 | | - // when started in development mode `next dev` or `npm run dev` regardless of the value of STAGING environmental variable |
12 | | - const isDev = phase === PHASE_DEVELOPMENT_SERVER |
13 | | - // when `next build` or `npm run build` is used |
14 | | - const isBuild = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1' |
15 | | - // when `next start` or `npm run start` is used |
16 | | - const isProd = phase === PHASE_PRODUCTION_SERVER |
17 | | - // when `next build` or `npm run build` is used |
18 | | - const isStaging = |
19 | | - phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1' |
20 | | - |
21 | | - const branch = process.env.BRANCH || 'master' |
22 | | - console.log(`branch: ${branch}\nisDev:${isDev} isBuild:${isBuild} isProd:${isProd} isStaging:${isStaging}`) |
23 | | - |
24 | | - return { |
25 | | - outputFileTracing: true, |
26 | | - eslint: { |
27 | | - ignoreDuringBuilds: true |
28 | | - }, |
29 | | - typescript: { |
30 | | - ignoreBuildErrors: true |
31 | | - }, |
32 | | - async rewrites() { |
33 | | - return [ |
34 | | - { |
35 | | - source: '/:path*', |
36 | | - destination: '/:path*', |
37 | | - }, |
38 | | - { |
39 | | - source: '/:path*', |
40 | | - destination: `/api/:path*`, |
41 | | - }, |
42 | | - ] |
43 | | - }, |
44 | | - } |
| 4 | + PHASE_DEVELOPMENT_SERVER, |
| 5 | + PHASE_PRODUCTION_BUILD, |
| 6 | + PHASE_PRODUCTION_SERVER, |
| 7 | +} = require('next/constants') |
| 8 | + |
| 9 | +// This uses phases as outlined here: https://nextjs.org/docs/#custom-configuration |
| 10 | +module.exports = (phase) => { |
| 11 | + // when started in development mode `next dev` or `npm run dev` regardless of the value of STAGING environmental variable |
| 12 | + const isDev = phase === PHASE_DEVELOPMENT_SERVER |
| 13 | + // when `next build` or `npm run build` is used |
| 14 | + const isBuild = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1' |
| 15 | + // when `next start` or `npm run start` is used |
| 16 | + const isProd = phase === PHASE_PRODUCTION_SERVER |
| 17 | + // when `next build` or `npm run build` is used |
| 18 | + const isStaging = |
| 19 | + phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1' |
| 20 | + |
| 21 | + const branch = process.env.BRANCH || 'master' |
| 22 | + console.log(`branch: ${branch}\nisDev:${isDev} isBuild:${isBuild} isProd:${isProd} isStaging:${isStaging}`) |
| 23 | + |
| 24 | + return { |
| 25 | + outputFileTracing: true, |
| 26 | + eslint: { |
| 27 | + ignoreDuringBuilds: true |
| 28 | + }, |
| 29 | + typescript: { |
| 30 | + ignoreBuildErrors: true |
| 31 | + }, |
| 32 | + async headers () { |
| 33 | + return [ |
| 34 | + { |
| 35 | + source: '/(.*)', |
| 36 | + headers: [ |
| 37 | + { key: 'X-Frame-Options', value: 'DENY' }, |
| 38 | + { key: 'Content-Security-Policy', value: "frame-ancestors 'none'" }, |
| 39 | + ], |
| 40 | + }, |
| 41 | + ] |
| 42 | + }, |
| 43 | + async rewrites () { |
| 44 | + return [ |
| 45 | + { |
| 46 | + source: '/:path*', |
| 47 | + destination: '/:path*', |
| 48 | + }, |
| 49 | + { |
| 50 | + source: '/:path*', |
| 51 | + destination: `/api/:path*`, |
| 52 | + }, |
| 53 | + ] |
| 54 | + }, |
45 | 55 | } |
| 56 | +} |
0 commit comments