-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathnext.config.js
56 lines (52 loc) · 1.15 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
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next');
/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Set this to true if you would like to use SVGR
// See: https://github.com/gregberge/vgr
svgr: false,
},
transpilePackages: ['crypto-hash'],
images: {
remotePatterns: [
{
protocol: 'http',
hostname: '**',
},
{
protocol: 'https',
hostname: '**',
},
],
},
async redirects() {
return [
{
source: '/api/uploads/:path*',
destination:
process.env.STORAGE_PROVIDER === 'local' ? '/uploads/:path*' : '/404',
permanent: true,
},
];
},
async rewrites() {
return [
{
source: '/uploads/:path*',
destination:
process.env.STORAGE_PROVIDER === 'local'
? '/api/uploads/:path*'
: '/404',
},
];
},
};
const plugins = [
// Add more Next.js plugins to this list if needed.
withNx,
];
module.exports = composePlugins(...plugins)(nextConfig);