forked from zbycz/osmapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
54 lines (50 loc) · 1.41 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
/* eslint-disable */
const packageJson = require('./package.json');
const withPWA = require('next-pwa')({
dest: 'public',
});
const languages = {
de: 'Deutsch',
cs: 'Česky',
en: 'English',
es: 'Español',
fr: 'Français',
it: 'Italiano',
pl: 'Polski',
am: 'አማርኛ',
};
module.exports = withPWA({
output: process.env.NEXTJS_OUTPUT || undefined,
//TODO fails with current webpack config. Probably needs to get rid of sentry? (@sentry/nextjs was not cool)
// future: {
// webpack5: true,
// },
publicRuntimeConfig: {
osmappVersion: packageJson.version.replace(/\.0$/, ''),
commitHash: (process.env.VERCEL_GIT_COMMIT_SHA || '').substr(0, 7),
commitMessage: process.env.VERCEL_GIT_COMMIT_MESSAGE || 'dev',
languages,
},
i18n: {
// we let next only handle URL, but chosen locale is in getServerIntl()
locales: ['default', ...Object.keys(languages)],
defaultLocale: 'default',
localeDetection: false,
},
webpack: (config, { dev, isServer }) => {
if (!dev) {
config.devtool = 'source-map';
for (const plugin of config.optimization.minimizer) {
if (plugin.constructor.name === 'TerserPlugin') {
plugin.options.sourceMap = true;
break;
}
}
}
config.resolve.alias = {
...(config.resolve.alias || {}),
...(isServer ? {} : { '@sentry/node': '@sentry/browser' }),
};
return config;
},
});