Skip to content

Next.js (static export)

Next.js can produce a fully static site: just a folder of files, exactly what Bailey needs. That folder is called out.

  1. In next.config.js, switch on export mode:

    next.config.js
    const nextConfig = {
    output: 'export',
    };
    module.exports = nextConfig;
  2. Build:

    Terminal window
    npm install
    npm run build
  3. An out folder appears. That’s the one you upload to Bailey.

  • Images: the optimized next/image component needs a server. For static, add images: { unoptimized: true } to next.config.js.
  • Internal links: Next handles paths correctly for a site served at the root, which is the case on your Bailey subdomain.
next.config.js
const nextConfig = {
output: 'export',
images: { unoptimized: true },
};
module.exports = nextConfig;

Still seeing a blank page? → Why your site looks broken.

Hosted on Bailey