forked from saleor/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
52 lines (49 loc) · 1.31 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
// eslint-disable-next-line
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
const apiURL = new URL(process.env.NEXT_PUBLIC_API_URI);
const allowedImageDomains = process.env.NEXT_PUBLIC_ALLOWED_IMAGE_DOMAINS
? process.env.NEXT_PUBLIC_ALLOWED_IMAGE_DOMAINS.split(",")
: [];
const imageConversionFormats = process.env.NEXT_PUBLIC_IMAGE_CONVERSION_FORMATS
? process.env.NEXT_PUBLIC_IMAGE_CONVERSION_FORMATS.split(",")
: [];
module.exports = withBundleAnalyzer({
reactStrictMode: true,
swcMinify: true,
images: {
domains: [apiURL.hostname, ...allowedImageDomains],
formats: imageConversionFormats,
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ["@svgr/webpack"],
});
return config;
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "x-content-type-options",
value: "nosniff",
},
{ key: "x-xss-protection", value: "1" },
{ key: "x-frame-options", value: "DENY" },
{
key: "strict-transport-security",
value: "max-age=31536000; includeSubDomains",
},
],
},
];
},
experimental: {
reactRoot: true,
},
});