/
next.config.js
52 lines (47 loc) · 1.22 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
const withSourceMaps = require('@zeit/next-source-maps')();
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const { SENTRY_ORG, SENTRY_PROJECT, RELEASE, COMMIT_SHA } = process.env
module.exports = withSourceMaps({
webpack: (config, { dev, isServer }) => {
const originalEntry = config.entry;
config.entry = async () => {
const entries = await originalEntry();
if (
entries['main.js'] &&
!entries['main.js'].includes('babel-polyfill')
) {
entries['main.js'].unshift('babel-polyfill');
}
return entries;
};
if (!isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser'
}
if (SENTRY_ORG && SENTRY_PROJECT) {
config.plugins.push(
new SentryWebpackPlugin({
include: '.next',
ignore: ['node_modules'],
urlPrefix: '/app/.next',
release: RELEASE,
setCommits: {
repo: "itdagene-ntnu/itdagene-webapp",
commit: COMMIT_SHA
}
})
)
}
return config;
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'cdn.itdagene.no',
port: '',
pathname: '/**',
},
],
},
swcMinify: true,
});