-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
113 lines (98 loc) · 3.52 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* eslint-disable sort-keys */
const runtimeCaching = require('next-pwa/cache');
const localesConfig = require('./locales.config');
const { withSentryConfig } = require('@sentry/nextjs');
const withPWA = require('next-pwa')({
dest: 'public',
// temporarly disabled!
disable: true,
runtimeCaching
});
const i18n = {
defaultLocale:
localesConfig.find(({ isDefault }) => isDefault)?.shortCode || 'en',
localeDetection: false,
locales: localesConfig.map(({ shortCode }) => shortCode)
};
const languageRedirects = [
{ source: '/en/:path*', destination: '/:path*' },
{ source: '/es-ES/:path*', destination: '/es/:path*' },
{ source: '/es-es/:path*', destination: '/es/:path*' },
{ source: '/fr-FR/:path*', destination: '/fr/:path*' },
{ source: '/fr-fr/:path*', destination: '/fr/:path*' },
{ source: '/pt-br/:path*', destination: '/pt/:path*' },
{ source: '/pt-BR/:path*', destination: '/pt/:path*' }
].map((redirect) => ({ ...redirect, permanent: true }));
const redirects = () => languageRedirects;
const images = {
domains: [
'impact-market.cdn.prismic.io',
'images.prismic.io',
'prismic-io.s3.amazonaws.com',
'dxdwf61ltxjyn.cloudfront.net',
'd3ma540h3o1zlk.cloudfront.net'
]
};
const webpack = (config, { webpack }) => {
config.resolve.fallback = {
...config.resolve.fallback,
child_process: false,
fs: false,
net: false,
readline: false
};
config.experiments = { ...config.experiments, topLevelAwait: true };
return config;
};
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: false
});
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
// eslint-disable-next-line no-process-env
dryRun: process.env.VERCEL_ENV !== 'production',
setCommits: {
auto: true,
ignoreMissing: true,
ignoreEmpty: true
},
deploy: {
// eslint-disable-next-line no-process-env
env: process.env.VERCEL_ENV || 'development'
},
org: 'impactmarket',
project: 'pwa'
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};
// https://github.com/GoogleChrome/workbox/issues/1790
module.exports = withBundleAnalyzer(
withSentryConfig(
withPWA({
i18n,
images,
redirects,
styledComponents: true,
webpack
}),
sentryWebpackPluginOptions,
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: '/monitoring',
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true
}
)
);