/
next.config.js
50 lines (41 loc) · 1.23 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
const withPlugins = require('next-compose-plugins');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
/**@type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
productionBrowserSourceMaps: true,
trailingSlash: true,
images: {
loader: 'custom',
domains: ['res.cloudinary.com', 's3-eu-west-1.amazonaws.com'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 2280, 2460, 2640, 2820, 3000],
},
env: {
NEXT_PUBLIC_EXT_BUILD_ID:
process.env.NEXT_PUBLIC_EXT_BUILD_ID ??
JSON.stringify(process.env.NETLIFY ? process.env.COMMIT_REF.substring(0, 7) : 'staging'),
},
webpack(config) {
if (!config.externals) config.externals = [];
config.externals.push('canvas');
return config;
},
async redirects() {
return [
{
source: '/storybook',
destination: '/storybook/index.html',
permanent: true,
},
];
},
async rewrites() {
return [
{ source: '/__preview/:path*', destination: '/preview/:path*' },
{ source: '/:locale/__preview/:path*', destination: '/:locale/preview/:path*' },
];
},
};
module.exports = withPlugins([withBundleAnalyzer], nextConfig);