Skip to content
David Reed edited this page Nov 20, 2026 · 1 revision

@sysce/estrogen/astro is an Astro integration that runs estrogen after the build, over the output directory.

import estrogen from '@sysce/estrogen/astro';
import { defineConfig } from 'astro/config';

export default defineConfig({
	integrations: [estrogen()],
});

The default export is estrogen(options?): AstroIntegration. It runs on Astro's astro:build:done hook, after Astro writes the build, over the final static output directory. For an SSR build it rewrites the client output directory. If any file fails, the build fails: estrogen fails closed and writes no partial output for a failing file.

Options

Pass the Node API options object to override what the integration infers. It fills dirs from the build output, so you usually set only the per-site data files:

integrations: [estrogen({ config: 'estrogen.toml' })];
integrations: [
	estrogen({ names: 'estrogen.names.json', canary: 'canary-list.json' }),
];

It takes the same fields as the other plugins except dirs. See Configuration for the config file.

Run once

estrogen is not idempotent. The integration runs once per build, on astro:build:done. Do not add it twice, and confirm each build writes a fresh output directory rather than reprocessing one estrogen already rewrote.

Source maps

By default estrogen writes no map and strips sourceMappingURL comments from the chunks it processes. If Astro is set to emit maps, those bundler maps point at pre-obfuscation source and estrogen keeps them out of the served output. For a private debug map, pass sourcemap in the options to write it outside the build. See Source maps.

The limit

The integration raises the cost of reading the build; it does not make the build secret. A decoder key ships in each file, and anyone with devtools can run the code. See Security and limits.

Clone this wiki locally