// stati.config.ts
import { defineConfig, getEnv } from '@stati/core';
// 'production' in stati build, 'development' in stati dev
const production = getEnv() === 'production';
export default defineConfig({
site: {
title: 'My site',
baseUrl: process.env.SITE_URL ?? (production ? 'https://example.com' : 'http://localhost:3000'),
},
seo: {
// SEO warnings while I work on the site
debug: !production,
},
});
- Stati never sets
NODE_ENV. A config that checksprocess.env.NODE_ENV === 'production'takes the development branch in a plainstati build, unless the script sets the variable itself. - For more targets than two, read a variable of your own:
SITE_URL=https://staging.example.com npm run build. - Stati only looks for
stati.config.ts,.jsor.mjsin the folder it runs in, so a separatestati.staging.tsis never read. One config, switched by variables. - The dev server reads the config once, when it starts. Restart it after changing the config or the variables it reads.
In the Stati docs: Multi-environment configuration and Environment configuration.