-
Notifications
You must be signed in to change notification settings - Fork 7
/
next.config.js
61 lines (58 loc) · 1.69 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
60
61
/** @type {import('next').NextConfig} */
const { PHASE_DEVELOPMENT_SERVER, PHASE_TEST } = require('next/constants');
const beta = process.env.BUILD_TYPE === 'beta' ? 'beta' : '';
const OPEN_CORS_HEADERS = [
// Allow for specific domains to have access or * for all
{
key: 'Access-Control-Allow-Origin',
value: '*',
// DOES NOT WORK
// value: process.env.ALLOWED_ORIGIN,
},
// Allows for specific methods accepted
{
key: 'Access-Control-Allow-Methods',
value: 'GET, POST, PUT, DELETE, OPTIONS',
},
// Allows for specific headers accepted (These are a few standard ones)
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization, Origin',
},
];
module.exports = (phase, { _defaultConfig }) => {
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
const isTest = phase === PHASE_TEST || 'CI' in process.env;
return {
output: !isDev && !isTest ? 'standalone' : undefined,
reactStrictMode: true,
trailingSlash: true,
productionBrowserSourceMaps: true,
assetPrefix: !isDev && !isTest ? `https://${beta}cdn.commanderspellbook.com` : undefined,
images: {
unoptimized: true,
},
serverRuntimeConfig: {
PROJECT_ROOT: __dirname,
},
webpack(webpackConfig) {
return {
...webpackConfig,
optimization: {
minimize: false, // SSG for combo pages fails to accept routes after the first if the code is minified - only went built (not dev server)
},
};
},
async headers() {
return [
{
source: '/embed.js',
headers: OPEN_CORS_HEADERS,
},
];
},
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
},
};
};