Skip to content

Conversation

brett-baron
Copy link

@brett-baron brett-baron commented Jul 21, 2025

Purpose

Contentful apps require static file deployment in order to be hosted. This change ensures that the Next.js app is exported as static HTML, CSS, and JS files rather than running as a server, aligning it with Contentful’s hosting requirements.

Approach

We configured the Next.js app for static export by:
• Adding output: "export" to generate static HTML files.
• Setting distDir: 'out' to match Contentful’s expected build output directory.
• Configuring images.unoptimized: true for static export compatibility.
• Adding assetPrefix: './' for proper asset loading in static contexts.
• Adding an upload script to package.json for easy deployment to Contentful.

We considered alternatives such as deploying with server-side rendering, but Contentful hosting requires static assets.

Testing steps

1.	Run npm run build to confirm the build generates static files in the out directory.
2.	Run npm run upload to deploy the app to Contentful.
3.	Open the app in Contentful to ensure it loads correctly with all assets displaying as expected.

Breaking Changes

This configuration is necessary for deployment but does not break existing local development workflows.

Dependencies and/or References

Next.js Static HTML Export documentation

Deployment

No special deployment considerations. After merging, developers can run the upload script to deploy the static app to Contentful.

…tful 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.
@brett-baron brett-baron requested review from a team as code owners July 21, 2025 22:59
Copy link

netlify bot commented Jul 21, 2025

👷 Deploy request for ecommerce-app-base-components pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0331269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant