-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
40 lines (37 loc) · 1.18 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
const { withSentryConfig } = require('@sentry/nextjs');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const CompressionPlugin = require('compression-webpack-plugin');
const { version } = require('./package.json');
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
env: {
APP_ENV: process.env.NODE_ENV,
API_DEVELOPMENT: process.env.API_DEVELOPMENT,
WEB_VERSION: version,
},
compiler: {
emotion: true,
},
compress: true,
webpack(config) {
const plugins = [...config.plugins, new CompressionPlugin()];
return { ...config, plugins };
},
sentry: {
hideSourceMaps: true,
disableServerWebpackPlugin: process.env.SENTRY_WEBPACK_PLUGIN_ENABLE !== 'true',
disableClientWebpackPlugin: process.env.SENTRY_WEBPACK_PLUGIN_ENABLE !== 'true',
},
output: 'export',
};
const sentryWebpackPluginOptions = {
silent: true,
authToken: process.env.SENTRY_AUTH_TOKEN,
};
module.exports = () => {
const plugins = [[withSentryConfig, sentryWebpackPluginOptions], [withBundleAnalyzer]];
return plugins.reduce((acc, cur) => cur[0](acc, cur[1] ?? undefined), nextConfig);
};