forked from BuilderIO/nextjs-shopify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
64 lines (63 loc) · 1.59 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
57
58
59
60
61
62
63
64
const bundleAnalyzer = require('@next/bundle-analyzer')({
enabled: !!process.env.BUNDLE_ANALYZE,
})
module.exports = bundleAnalyzer({
images: {
domains: ['cdn.shopify.com', 'cdn.builder.io'],
},
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value:
'frame-ancestors https://*.builder.io https://builder.io http://localhost:1234',
},
],
},
]
},
env: {
// expose env to the browser
SHOPIFY_STOREFRONT_API_TOKEN: process.env.SHOPIFY_STOREFRONT_API_TOKEN,
SHOPIFY_STORE_DOMAIN: process.env.SHOPIFY_STORE_DOMAIN,
BUILDER_PUBLIC_KEY: process.env.BUILDER_PUBLIC_KEY,
},
i18n: {
// These are all the locales you want to support in
// your application
locales: ['en-US', 'es'],
// This is the default locale you want to be used when visiting
// a non-locale prefixed path e.g. `/hello`
defaultLocale: 'en-US',
},
rewrites() {
return [
// Rewrites for /search
{
source: '/:locale/search',
destination: '/search',
},
{
source: '/:locale/search/:path*',
destination: '/search',
},
{
source: '/search/designers/:name',
destination: '/search',
},
{
source: '/search/designers/:name/:category',
destination: '/search',
},
{
// This rewrite will also handle `/search/designers`
source: '/search/:category',
destination: '/search',
locale: false,
},
]
},
})