Files
Suman/apps/suman-bosna/next.config.js
Nermin Karic 899ed44562 fix: webpack build, low memory limits, and sitemap try/catch for Docker deploy
- Switch both storefronts from Turbopack to Webpack (next build --webpack)
- Limit build workers to 1 CPU (experimental.cpus: 1)
- Reduce NODE_OPTIONS max-old-space-size from 2048 to 1024 MB
- Wrap sitemap.ts API calls in try/catch to prevent build crash when backend is unavailable during Docker build
- During build, sitemap returns static paths only; at runtime it fetches full dynamic data
2026-11-23 01:59:50 +01:00

95 lines
2.0 KiB
JavaScript

const checkEnvVariables = require("./check-env-variables")
checkEnvVariables()
/**
* Medusa Cloud-related environment variables
*/
const S3_HOSTNAME = process.env.MEDUSA_CLOUD_S3_HOSTNAME
const S3_PATHNAME = process.env.MEDUSA_CLOUD_S3_PATHNAME
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
experimental: {
cpus: 1,
},
async headers() {
return [
{
source: "/:path*",
headers: [{ key: "Link", value: '</.well-known/ucp>; rel="ucp"' }],
},
{
source: "/:countryCode/products/:handle",
headers: [{ key: "Vary", value: "Accept" }],
},
]
},
async rewrites() {
return {
beforeFiles: [
{
source: "/:countryCode/products/:handle([^/.]+).md",
destination: "/:countryCode/products/:handle/markdown",
},
{
source: "/:countryCode/products/:handle([^/.]+)",
has: [{ type: "header", key: "accept", value: ".*text/markdown.*" }],
destination: "/:countryCode/products/:handle/markdown",
},
],
}
},
logging: {
fetches: {
fullUrl: true,
},
},
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "http",
hostname: "localhost",
},
{
protocol: "https",
hostname: "placehold.co",
},
{
protocol: "https",
hostname: "suman.ba",
},
{
protocol: "https",
hostname: "images.unsplash.com",
},
{
protocol: "https",
hostname: "*.s3.*.amazonaws.com",
},
{
protocol: "https",
hostname: "*.s3.amazonaws.com",
},
...(S3_HOSTNAME && S3_PATHNAME
? [
{
protocol: "https",
hostname: S3_HOSTNAME,
pathname: S3_PATHNAME,
},
]
: []),
],
},
}
module.exports = nextConfig