-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
86 lines (76 loc) · 1.91 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require('dotenv').config()
const path = require('path')
const withOffline = require('next-offline')
module.exports = withOffline({
poweredByHeader: false,
// Build environment variables
env: {
GOOGLE_ANALYTICS: process.env.GOOGLE_ANALYTICS,
CLOUD_MODE: process.env.CLOUD_MODE,
},
dontAutoRegisterSw: true,
generateSw: false,
workboxOpts: {
swSrc: path.resolve(__dirname, './lib/workbox.ts'),
swDest: 'static/service-worker.js',
},
async redirects() {
return [
{
source: `/basic-auth`,
destination: '/',
permanent: false,
},
]
},
async rewrites() {
return [
{
source: `/service-worker.js`,
destination: '/_next/static/service-worker.js',
},
/**
* Proxy GraphQL
*/
{
source: '/graphql',
destination: '/api/graphql',
},
/**
* URlResolver
*/
{
source: '/:pathname*',
destination: '/_url-resolver',
},
]
},
webpack: config => {
/**
* SVG Inline
*/
config.module.rules.push({
test: /\.svg$/,
use: 'react-svg-loader',
})
/**
* GraphQL Queries
*/
config.module.rules.push({
test: /\.(graphql|gql)$/,
loader: 'graphql-tag/loader',
})
/**
* Fix for missing 'fs' module not found
* https://github.com/webpack-contrib/css-loader/issues/447
*/
config.node = {
fs: 'empty',
}
config.resolve.alias = {
...config.resolve.alias,
'~': path.resolve(__dirname),
}
return config
},
})