forked from vercel/commerce
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
36 lines (35 loc) · 868 Bytes
/
next.config.ts
File metadata and controls
36 lines (35 loc) · 868 Bytes
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
const shopifyHost =
process.env.SHOPIFY_STORE_DOMAIN?.replace(/^https?:\/\//, '').split('/')[0] ||
(process.env.SHOPIFY_STORE_SUBDOMAIN
? `${process.env.SHOPIFY_STORE_SUBDOMAIN}.myshopify.com`
: null);
export default {
experimental: {
useCache: true
},
async redirects() {
if (!shopifyHost || shopifyHost.includes('[')) return [];
return [
{
source: '/cart/c/:path*',
destination: `https://${shopifyHost}/cart/c/:path*`,
permanent: false
},
{
source: '/a/downloads/:path*',
destination: `https://${shopifyHost}/a/downloads/:path*`,
permanent: false
}
];
},
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{
protocol: 'https',
hostname: 'cdn.shopify.com',
pathname: '/s/files/**'
}
]
}
};