-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
42 lines (37 loc) · 1.06 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
// @ts-check
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
/**
* @type {import('next').NextConfig}
*/
module.exports = async (phase, { defaultConfig }) => {
const STRAPI_API_URL = process.env.STRAPI_API_URL || "http://172.18.0.5:1337";
const resWebsite = await fetch(
`${STRAPI_API_URL}/api/websites/1?fields=imageURL`,
);
const dataWebsite = await resWebsite.json();
const websiteImageURL = dataWebsite.data.attributes.imageURL;
const imageHostname = new URL(websiteImageURL).hostname;
const nextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: "https",
hostname: imageHostname,
port: "",
pathname: "/**",
},
],
minimumCacheTTL: 6000,
formats: ["image/avif", "image/webp"],
contentDispositionType: "inline",
},
experimental: {
optimizePackageImports: ["@vidstack/react"],
},
};
if (phase === PHASE_DEVELOPMENT_SERVER) {
// Additional configuration for development server
}
return nextConfig;
};