-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblitz.config.js
61 lines (57 loc) · 2.35 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
// module.exports = {
// webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
// // Note: we provide webpack above so you should not `require` it
// // Perform customizations to webpack config
// // Important: return the modified config
// return config
// },
// webpackDevMiddleware: (config) => {
// // Perform customizations to webpack dev middleware config
// // Important: return the modified config
// return config
// },
// }
// Use the hidden-source-map option when you don't want the source maps to be
// publicly available on the servers, only to the error reporting
const withSourceMaps = require('@zeit/next-source-maps')();
// Use the SentryWebpack plugin to upload the source maps during build step
// const SentryWebpackPlugin = require('@sentry/webpack-plugin')
// const { SENTRY_DSN, SENTRY_ORG, SENTRY_PROJECT } = process.env
module.exports = withSourceMaps({
experimental: {
reactRefresh: true,
},
webpack: (config, options) => {
// In `pages/_app.js`, Sentry is imported from @sentry/node. While
// @sentry/browser will run in a Node.js environment, @sentry/node will use
// Node.js-only APIs to catch even more unhandled exceptions.
//
// This works well when Next.js is SSRing your page on a server with
// Node.js, but it is not what we want when your client-side bundle is being
// executed by a browser.
//
// Luckily, Next.js will call this webpack function twice, once for the
// server and once for the client. Read more:
// https://nextjs.org/docs#customizing-webpack-config
//
// So ask Webpack to replace @sentry/node imports with @sentry/browser when
// building the browser's bundle
if (!options.isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser';
}
// When all the Sentry configuration env variables are available/configured
// The Sentry webpack plugin gets pushed to the webpack plugins to build
// and upload the source maps to sentry.
// This is an alternative to manually uploading the source maps
// if (SENTRY_DSN && SENTRY_ORG && SENTRY_PROJECT) {
// config.plugins.push(
// new SentryWebpackPlugin({
// include: '.next',
// ignore: ['node_modules'],
// urlPrefix: '~/_next',
// })
// )
// }
return config;
},
});