Repository navigation
esbuild
@sysce/estrogen/esbuild is an esbuild plugin that runs estrogen after the build, over
the output directory.
import estrogen from '@sysce/estrogen/esbuild';
import { build } from 'esbuild';
await build({
entryPoints: ['src/index.ts'],
bundle: true,
outdir: 'dist',
plugins: [estrogen()],
});The default export is estrogen(options?): esbuild.Plugin. It runs in the build's
end phase, over outdir (or the directory of outfile). If any file fails, the
build fails: estrogen fails closed and writes no partial output for a failing file.
Pass the Node API options object to override what the plugin infers.
It infers dirs from the build output, so you usually set only the per-site data
files:
plugins: [estrogen({ config: 'estrogen.toml' })];plugins: [
estrogen({ names: 'estrogen.names.json', canary: 'canary-list.json' }),
];See Configuration for the config file.
estrogen is not idempotent. The plugin runs once per build, at the end. Do not add it twice, and in watch mode confirm each rebuild writes a fresh output directory rather than reprocessing one estrogen already rewrote.
By default estrogen writes no map and strips sourceMappingURL comments from the
chunks it processes. If esbuild 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 plugin options to write it outside the
build. See Source maps.
@sysce/estrogen ·
Fracital/estrogen · ISC · by David Reed.
estrogen raises the cost of reading a build; it does not make it secret.