|
@@ -1,20 +1,74 @@
|
1
|
1
|
const withPWA = require('next-pwa')
|
2
|
|
-const { withSentryConfig } = require('@sentry/nextjs')
|
|
2
|
+const SentryWebpackPlugin = require('@sentry/webpack-plugin')
|
3
|
3
|
|
4
|
|
-const SentryWebpackPluginOptions = {
|
5
|
|
- silent: process.env.NODE_ENV === 'development',
|
6
|
|
-}
|
|
4
|
+const {
|
|
5
|
+ NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN,
|
|
6
|
+ SENTRY_ORG,
|
|
7
|
+ SENTRY_PROJECT,
|
|
8
|
+ SENTRY_AUTH_TOKEN,
|
|
9
|
+ NODE_ENV,
|
|
10
|
+ VERCEL_GIT_COMMIT_SHA,
|
|
11
|
+ SUPABASE_KEY,
|
|
12
|
+ SUPABASE_URL,
|
|
13
|
+ GA_MEASUREMENT_ID,
|
|
14
|
+} = process.env
|
7
|
15
|
|
8
|
|
-module.exports = withSentryConfig(
|
9
|
|
- withPWA({
|
10
|
|
- future: {
|
11
|
|
- webpack5: true,
|
12
|
|
- },
|
13
|
|
- pwa: {
|
14
|
|
- dest: 'public',
|
15
|
|
- scope: '/',
|
16
|
|
- disable: process.env.NODE_ENV === 'development',
|
17
|
|
- },
|
18
|
|
- }),
|
19
|
|
- SentryWebpackPluginOptions
|
20
|
|
-)
|
|
16
|
+process.env.SENTRY_DSN = SENTRY_DSN
|
|
17
|
+
|
|
18
|
+const basePath = ''
|
|
19
|
+
|
|
20
|
+module.exports = withPWA({
|
|
21
|
+ future: {
|
|
22
|
+ webpack5: true,
|
|
23
|
+ },
|
|
24
|
+ pwa: {
|
|
25
|
+ dest: 'public',
|
|
26
|
+ scope: '/',
|
|
27
|
+ disable: process.env.NODE_ENV === 'development',
|
|
28
|
+ },
|
|
29
|
+
|
|
30
|
+ productionBrowserSourceMaps: true,
|
|
31
|
+ env: {
|
|
32
|
+ NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA,
|
|
33
|
+ SUPABASE_KEY: SUPABASE_KEY,
|
|
34
|
+ SUPABASE_URL: SUPABASE_URL,
|
|
35
|
+ GA_MEASUREMENT_ID: GA_MEASUREMENT_ID,
|
|
36
|
+ },
|
|
37
|
+ webpack: (config, options) => {
|
|
38
|
+ if (!options.isServer) {
|
|
39
|
+ config.resolve.alias['@sentry/node'] = '@sentry/browser'
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ config.plugins.push(
|
|
43
|
+ new options.webpack.DefinePlugin({
|
|
44
|
+ 'process.env.NEXT_IS_SERVER': JSON.stringify(
|
|
45
|
+ options.isServer.toString()
|
|
46
|
+ ),
|
|
47
|
+ })
|
|
48
|
+ )
|
|
49
|
+
|
|
50
|
+ if (
|
|
51
|
+ SENTRY_DSN &&
|
|
52
|
+ SENTRY_ORG &&
|
|
53
|
+ SENTRY_PROJECT &&
|
|
54
|
+ SENTRY_AUTH_TOKEN &&
|
|
55
|
+ VERCEL_GIT_COMMIT_SHA &&
|
|
56
|
+ NODE_ENV === 'production'
|
|
57
|
+ ) {
|
|
58
|
+ config.plugins.push(
|
|
59
|
+ new SentryWebpackPlugin({
|
|
60
|
+ include: '.next',
|
|
61
|
+ ignore: ['node_modules'],
|
|
62
|
+ stripPrefix: ['webpack://_N_E/'],
|
|
63
|
+ urlPrefix: `~${basePath}/_next`,
|
|
64
|
+ release: VERCEL_GIT_COMMIT_SHA,
|
|
65
|
+ authToken: SENTRY_AUTH_TOKEN,
|
|
66
|
+ org: SENTRY_PROJECT,
|
|
67
|
+ project: SENTRY_ORG,
|
|
68
|
+ })
|
|
69
|
+ )
|
|
70
|
+ }
|
|
71
|
+ return config
|
|
72
|
+ },
|
|
73
|
+ basePath,
|
|
74
|
+})
|