This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
66 lines (61 loc) · 1.49 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
62
63
64
65
66
const withOffline = require('next-offline');
const withTranslate = require('next-translate');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const { API_URL, BACKEND_URL, FRONTEND_URL, SA_URL, EMAIL_ADDRESS, BUILD_DATE } = process.env;
const config = {
target: 'server',
env: {
API_URL,
BACKEND_URL: BACKEND_URL || API_URL, // In prod these are the same, so we only define the first one.
FRONTEND_URL,
SA_URL,
EMAIL_ADDRESS,
BUILD_DATE,
},
typescript: {
ignoreDevErrors: true,
},
workboxOpts: {
swDest: 'static/service-worker.js',
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'offlineCache',
expiration: {
maxEntries: 200,
},
},
},
],
},
rewrites: async () => [
{
source: '/service-worker.js',
destination: '/_next/static/service-worker.js',
},
],
headers: async () => [
{
source: '/:path*',
headers: [
{
key: 'Permissions-Policy',
value: 'interest-cohort=()',
},
],
},
],
webpack: (config, options) => {
config.module.rules.push({
test: /\.graphql$/,
exclude: /node_modules/,
use: [options.defaultLoaders.babel, { loader: 'graphql-let/loader' }],
});
return config;
},
};
module.exports = withBundleAnalyzer(withOffline(withTranslate(config)));