-
-
Notifications
You must be signed in to change notification settings - Fork 120
/
next.config.js
50 lines (46 loc) · 1.13 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
const i18Config = require("./next-i18next.config")
const config = {
images: {
loader: "custom"
},
compiler: {
styledComponents: true
},
eslint: {
dirs: ["pages", "components", "functions/src", "tests", "analysis"]
},
i18n: i18Config.i18n
}
/** @type {import('next').NextConfig} */
module.exports = {
...config,
async redirects() {
return [redirectFirebaseAuthHandlers()]
},
async rewrites() {
return [
{
source: "/policies",
destination: "/policies/privacy-policy"
}
]
}
}
/**
* Redirect auth handler paths to the hosted firebase pages. This avoids having
* to implement these pages ourselves in next.js but continues to depend on
* firebase hosting a bit.
*b
* In production, FIREBASE_AUTH_DOMAIN is set to digital-testimony-prod.web.app.
*
* @see https://firebase.google.com/docs/auth/custom-email-handler
*/
const redirectFirebaseAuthHandlers = () => {
const firebaseDomain =
process.env.FIREBASE_AUTH_DOMAIN ?? "digital-testimony-dev.web.app"
return {
source: "/__/:path*",
destination: `https://${firebaseDomain}/__/:path*`,
permanent: false
}
}