|
1 |
| -const { withSentryConfig } = require('@sentry/nextjs'); |
2 |
| - |
3 |
| -module.exports = withSentryConfig( |
4 |
| - { |
5 |
| - env: { |
6 |
| - BUILD_VERSION: (process.env.GITHUB_SHA ?? '').slice(0, 7), |
7 |
| - SENTRY_RELEASE: process.env.SENTRY_RELEASE ?? '', |
8 |
| - SENTRY_DSN: process.env.SENTRY_DSN ?? '', |
9 |
| - SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT ?? 'development', |
10 |
| - GITBOOK_ASSETS_PREFIX: process.env.GITBOOK_ASSETS_PREFIX, |
11 |
| - GITBOOK_ICONS_URL: process.env.GITBOOK_ICONS_URL, |
12 |
| - GITBOOK_ICONS_TOKEN: process.env.GITBOOK_ICONS_TOKEN, |
13 |
| - NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY, |
14 |
| - }, |
15 |
| - |
16 |
| - webpack(config, { dev, webpack }) { |
17 |
| - config.resolve.fallback = { |
18 |
| - ...config.resolve.fallback, |
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + BUILD_VERSION: (process.env.GITHUB_SHA ?? '').slice(0, 7), |
| 4 | + GITBOOK_ASSETS_PREFIX: process.env.GITBOOK_ASSETS_PREFIX, |
| 5 | + GITBOOK_ICONS_URL: process.env.GITBOOK_ICONS_URL, |
| 6 | + GITBOOK_ICONS_TOKEN: process.env.GITBOOK_ICONS_TOKEN, |
| 7 | + NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY, |
| 8 | + }, |
19 | 9 |
|
20 |
| - // Required for `swagger2openapi` to work: |
21 |
| - fs: false, |
22 |
| - path: false, |
23 |
| - http: false, |
24 |
| - }; |
| 10 | + webpack(config) { |
| 11 | + config.resolve.fallback = { |
| 12 | + ...config.resolve.fallback, |
25 | 13 |
|
26 |
| - // Tree shake debug code for Sentry |
27 |
| - // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/tree-shaking/#tree-shaking-with-nextjs |
28 |
| - if (!dev) { |
29 |
| - config.plugins.push( |
30 |
| - new webpack.DefinePlugin({ |
31 |
| - __SENTRY_DEBUG__: false, |
32 |
| - // We always init Sentry with enableTracing: false for now, so this is useless |
33 |
| - __SENTRY_TRACING__: false, |
34 |
| - __RRWEB_EXCLUDE_IFRAME__: true, |
35 |
| - __RRWEB_EXCLUDE_SHADOW_DOM__: true, |
36 |
| - __SENTRY_EXCLUDE_REPLAY_WORKER__: true, |
37 |
| - }) |
38 |
| - ); |
39 |
| - } |
| 14 | + // Required for `swagger2openapi` to work: |
| 15 | + fs: false, |
| 16 | + path: false, |
| 17 | + http: false, |
| 18 | + }; |
40 | 19 |
|
41 |
| - return config; |
42 |
| - }, |
| 20 | + return config; |
| 21 | + }, |
43 | 22 |
|
44 |
| - async headers() { |
45 |
| - return [ |
46 |
| - // Cache all static assets for 1 year |
47 |
| - { |
48 |
| - source: '/~gitbook/static/:path*', |
49 |
| - headers: [ |
50 |
| - { |
51 |
| - key: 'Cache-Control', |
52 |
| - value: 'public, max-age=31536000, immutable', |
53 |
| - }, |
54 |
| - ], |
55 |
| - }, |
56 |
| - ]; |
57 |
| - }, |
| 23 | + async headers() { |
| 24 | + return [ |
| 25 | + // Cache all static assets for 1 year |
| 26 | + { |
| 27 | + source: '/~gitbook/static/:path*', |
| 28 | + headers: [ |
| 29 | + { |
| 30 | + key: 'Cache-Control', |
| 31 | + value: 'public, max-age=31536000, immutable', |
| 32 | + }, |
| 33 | + ], |
| 34 | + }, |
| 35 | + ]; |
| 36 | + }, |
58 | 37 |
|
59 |
| - assetPrefix: process.env.GITBOOK_ASSETS_PREFIX, |
60 |
| - poweredByHeader: false, |
| 38 | + assetPrefix: process.env.GITBOOK_ASSETS_PREFIX, |
| 39 | + poweredByHeader: false, |
61 | 40 |
|
62 |
| - images: { |
63 |
| - remotePatterns: [ |
64 |
| - { |
65 |
| - protocol: 'https', |
66 |
| - hostname: '*.gitbook.io', |
67 |
| - }, |
68 |
| - ], |
69 |
| - }, |
| 41 | + images: { |
| 42 | + remotePatterns: [ |
| 43 | + { |
| 44 | + protocol: 'https', |
| 45 | + hostname: '*.gitbook.io', |
| 46 | + }, |
| 47 | + ], |
70 | 48 | },
|
71 |
| - { |
72 |
| - release: process.env.SENTRY_RELEASE, |
73 |
| - org: process.env.SENTRY_ORG, |
74 |
| - project: process.env.SENTRY_PROJECT, |
75 |
| - authToken: process.env.SENTRY_AUTH_TOKEN, |
76 |
| - |
77 |
| - // Upload a larger set of source maps for prettier stack traces (increases build time) |
78 |
| - widenClientFileUpload: true, |
79 |
| - // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) |
80 |
| - tunnelRoute: '/~gitbook/monitoring', |
81 |
| - disableLogger: true, |
82 |
| - } |
83 |
| -); |
| 49 | +}; |
0 commit comments