-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
39 lines (35 loc) · 876 Bytes
/
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
const path = require('path');
const baseConfig = {
trailingSlash: true,
images: {
unoptimized: true,
domains: ['a.storyblok.com'],
},
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname),
};
return config;
},
};
// All of these only apply for static builds
if (process.env.BUILD_MODE === 'static') {
baseConfig.output = 'export';
baseConfig.distDir = 'out';
delete baseConfig.images.domains;
baseConfig.images.loader = 'custom';
baseConfig.images.loaderFile = './utils/imageLoader.js';
}
const nextConfig = process.env.NODE_ENV === 'development'
? {
...baseConfig,
rewrites: async () => ([
{
source: '/api-server/:path*',
destination: 'http://localhost:4321/api-server/:path*'
}
])
}
: baseConfig;
module.exports = nextConfig