-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathblitz.config.js
82 lines (74 loc) · 1.73 KB
/
blitz.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
const { sessionMiddleware, simpleRolesIsAuthorized } = require("blitz")
const withSourceMaps = require("@zeit/next-source-maps")()
const {
SENTRY_DSN,
SENTRY_ORG,
SENTRY_PROJECT,
SENTRY_AUTH_TOKEN,
NODE_ENV,
HEROKU_SLUG_COMMIT,
VERCEL_GITHUB_COMMIT_SHA,
} = process.env
const COMMIT_SHA = VERCEL_GITHUB_COMMIT_SHA || HEROKU_SLUG_COMMIT
const SentryWebpackPlugin = require("@sentry/webpack-plugin")
module.exports = withSourceMaps({
env: {
SENTRY_DSN: process.env.SENTRY_DSN,
},
middleware: [
sessionMiddleware({
isAuthorized: simpleRolesIsAuthorized,
}),
],
images: {
domains: ["pbs.twimg.com"],
},
async redirects() {
return [
{
source: "/docs",
destination: "https://docs.quirrel.dev",
permanent: true,
},
{
source: "/roadmap",
destination: "https://github.com/orgs/quirrel-dev/projects/1",
permanent: true,
},
{
source: "/gh",
destination: "https://github.com/quirrel-dev",
permanent: true,
},
{
source: "/github",
destination: "https://github.com/quirrel-dev",
permanent: true,
},
]
},
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.alias["@sentry/node"] = "@sentry/browser"
}
if (
SENTRY_DSN &&
SENTRY_ORG &&
SENTRY_PROJECT &&
SENTRY_AUTH_TOKEN &&
COMMIT_SHA &&
NODE_ENV === "production"
) {
config.plugins.push(
new SentryWebpackPlugin({
include: ".next",
ignore: ["node_modules"],
stripPrefix: ["webpack://_N_E/"],
urlPrefix: `~/_next`,
release: COMMIT_SHA,
})
)
}
return config
},
})