Skip to content

recipes/nextjs_static

View source on GitHub

typescript
import '@catapultjs/deploy/recipes/nextjs_static'

This recipe runs next build locally before the remote deployment starts and sets source_path to ./out/., the default output directory for a static Next.js export.

By default, Catapult transfers source_path with SCP through the built-in deploy:update_code task. You can optionally import rsync if you prefer rsync-based transfers.

See the example static Next.js project for a complete setup, or go directly to deploy.ts.

Tasks

TaskInsertedDescription
deploy:buildbefore deploy:lockRuns next build on the local machine

Configuration

KeyTypeDefaultDescription
source_pathstring'./out/.'Local static export directory to transfer
typescript
import '@catapultjs/deploy/recipes/nextjs_static'

Optional rsync transfer:

typescript
import '@catapultjs/deploy/recipes/nextjs_static'
import '@catapultjs/deploy/recipes/rsync'

For static export output, make sure your Next.js config enables it:

typescript
const nextConfig = {
  output: 'export',
}

export default nextConfig