Skip to content

fix(website): enable Next.js static export for GitHub Pages#393

Closed
ajitpratap0 wants to merge 1 commit into
mainfrom
fix/website-static-export
Closed

fix(website): enable Next.js static export for GitHub Pages#393
ajitpratap0 wants to merge 1 commit into
mainfrom
fix/website-static-export

Conversation

@ajitpratap0

Copy link
Copy Markdown
Owner

Summary

  • Add output: 'export' and images: { unoptimized: true } to next.config.ts so next build generates static HTML into website/out/
  • Update website.yml artifact path from website/dist (Astro) → website/out (Next.js)
  • Restore website/public/CNAME with gosqlx.dev to preserve the custom domain on each deploy

Why

The deploy workflow was failing with tar: website/dist: Cannot open: No such file or directory after migrating from Astro to Next.js in #390.

🤖 Generated with Claude Code

- Add output: 'export' and images.unoptimized for static site generation
- Update workflow artifact path from dist to out (Next.js export output dir)
- Restore CNAME file to preserve gosqlx.dev custom domain on deploy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the ci-cd label Mar 17, 2026
@github-actions

github-actions Bot commented Mar 17, 2026

Copy link
Copy Markdown

Claude finished @ajitpratap0's task —— View job


PR Review: Next.js Static Export Configuration ✅

I've completed my review of this pull request that fixes the website deployment workflow after the Astro → Next.js migration.

Review Tasks:

  • Read and analyze all changed files
  • Review Next.js static export configuration
  • Analyze GitHub workflow changes
  • Check security implications
  • Assess performance considerations
  • Provide comprehensive feedback

🔍 Overall Assessment

This PR correctly addresses the deployment issue by properly configuring Next.js static export. The changes are minimal, focused, and appropriate for GitHub Pages hosting.

What's Working Well

1. Next.js Configuration (website/next.config.ts:9-12)

  • output: 'export' correctly enables static HTML generation
  • images: { unoptimized: true } is required for static export (Next.js Image Optimization API doesn't work with static exports)
  • ✅ Existing security headers (CSP, X-Frame-Options, etc.) are preserved
  • ✅ URL redirects are maintained for backward compatibility

2. Workflow Update (.github/workflows/website.yml:56)

  • ✅ Artifact path correctly updated from website/distwebsite/out (Next.js default static export directory)
  • ✅ Build process remains unchanged (npm run build)
  • ✅ WASM integration is properly maintained

3. Custom Domain (website/public/CNAME)

  • ✅ Correctly restores gosqlx.dev custom domain
  • ✅ File placement in public/ ensures it's copied to output directory

🛡️ Security Analysis

  • No security concerns - all changes are configuration-only
  • ✅ Strong CSP headers are preserved with appropriate directives for the use case
  • ✅ Security headers (X-Frame-Options: DENY, X-Content-Type-Options: nosniff) remain intact
  • ✅ CNAME file contains only the expected domain

Performance Considerations

  • ✅ Static export will improve performance (no server-side rendering overhead)
  • unoptimized: true for images is necessary but may impact loading performance
  • 💡 Suggestion: Consider implementing responsive images or WebP conversion in the build pipeline if image optimization is needed

🧪 Test Coverage

  • ⚠️ Missing: No tests verify the static export configuration
  • 💡 Suggestion: Consider adding a test that verifies next build generates the expected out/ directory structure

🔧 Code Quality

  • ✅ TypeScript configuration is properly typed (NextConfig)
  • ✅ Consistent code style
  • ✅ Configuration is well-structured and readable

📋 Minor Suggestions

  1. Documentation: Consider adding a comment in next.config.ts explaining why unoptimized: true is required:

    images: {
      unoptimized: true, // Required for static export - Next.js Image Optimization API doesn't work with static sites
    },
  2. Validation: The workflow could validate that the out/ directory exists before uploading:

    - name: Verify build output
      run: |
        if [ ! -d "website/out" ]; then
          echo "Error: website/out directory not found"
          exit 1
        fi

🎯 Conclusion

This is a solid fix that properly addresses the deployment failure. The changes are:

  • Correct: Properly configures Next.js for static export
  • Minimal: Only changes what's necessary
  • Safe: No security or breaking changes
  • Complete: Addresses all aspects of the deployment pipeline

Recommendation: ✅ Approve and merge

The PR successfully resolves the deployment issue while maintaining all existing functionality. The static export configuration is standard and appropriate for GitHub Pages hosting.


@ajitpratap0

Copy link
Copy Markdown
Owner Author

Closing — moving to Vercel deployment instead of GitHub Pages static export. Next.js doesn't need output: 'export' on Vercel.

@ajitpratap0 ajitpratap0 deleted the fix/website-static-export branch March 17, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant