From 033126952ec82459e45f429c411bacf7ccdec972 Mon Sep 17 00:00:00 2001 From: Brett Baron Date: Mon, 21 Jul 2025 16:50:16 -0600 Subject: [PATCH] Configured Next.js build settings to support static export for Contentful app deployment. - Added `output: "export"` to generate static HTML files - Set `distDir: 'out'` to match Contentful's expected build output directory - Configured `images.unoptimized: true` for static export compatibility - Added `assetPrefix: './'` for proper asset loading in static context - Added `upload` script to package.json for easy deployment to Contentful Contentful apps require static file deployment in order to be hosted, which means the Next.js app must be exported as static HTML/CSS/JS files rather than running as a server. This configuration ensures the app builds correctly for Contentful's hosting environment. --- examples/nextjs/next.config.js | 6 ++++++ examples/nextjs/package.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/nextjs/next.config.js b/examples/nextjs/next.config.js index 3d3bc9990d..7acbdb8ea3 100755 --- a/examples/nextjs/next.config.js +++ b/examples/nextjs/next.config.js @@ -2,6 +2,12 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, + output: "export", + distDir: 'out', + images: { + unoptimized: true + }, + assetPrefix: './', }; module.exports = nextConfig; diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index fa7ca7bfca..b218508400 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -10,7 +10,8 @@ "test": "jest --watch", "test:ci": "jest --ci", "create-app-definition": "contentful-app-scripts create-app-definition", - "add-locations": "contentful-app-scripts add-locations" + "add-locations": "contentful-app-scripts add-locations", + "upload": "contentful-app-scripts upload --bundle-dir out" }, "dependencies": { "@contentful/app-sdk": "4.22.0",