evanw/esbuild · error · Error
Invalid footer file type
Error message
Invalid footer file type: ${type} What it means
The `footer` option (build) mirrors `banner`: a map of file type to text, serialized as `--footer:TYPE=TEXT`. An '=' inside the TYPE breaks parsing, so esbuild rejects it at lib/shared/common.ts:328.
Solutions
- Use a valid file type key without '=' (commonly 'js' or 'css').
- Strip '=' from generated keys.
Example fix
// before
await build({ entryPoints: ['app.ts'], footer: { 'js=x': '/* trailer */' } })
// after
await build({ entryPoints: ['app.ts'], footer: { js: '/* trailer */' } }) Defensive patterns
Strategy: validation
Validate before calling
const VALID_FOOTER_TYPES = new Set(['js', 'css'])
function assertFooterKeys(map) {
for (const k of Object.keys(map ?? {})) {
if (!VALID_FOOTER_TYPES.has(k)) throw new Error(`footer key must be 'js' or 'css', got ${k}`)
}
}
assertFooterKeys(options.footer) Prevention
- Restrict footer keys to 'js' or 'css'.
- Don't embed '=' or filenames in footer keys.
- Keep footer text in the value position.
When it happens
Trigger: Passing `footer: { 'css=x': '...' }` or any footer key containing '='.
Common situations: Typo or generated key; using the wrong file-type identifier.
Related errors
- Expected in mangle cache to map to either a string or false
- Expected value for supported
- Expected value for to be a string, got instead
- Invalid banner file type
- Invalid charset
AI-assisted analysis of evanw/esbuild@f6058f8364 (2026-08-09).
Data as JSON: /api/errors/cd6b82f1394e9f90.
Report an issue: GitHub.
Appendix: source
Thrown at lib/shared/common.ts:328
if (assetNames) flags.push(`--asset-names=${assetNames}`)
if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, 'main field')}`)
if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, 'condition')}`)
if (external) for (let name of external) flags.push(`--external:${validateStringValue(name, 'external')}`)
if (alias) {
for (let old in alias) {
if (old.indexOf('=') >= 0) throw new Error(`Invalid package name in alias: ${old}`)
flags.push(`--alias:${old}=${validateStringValue(alias[old], 'alias', old)}`)
}
}
if (banner) {
for (let type in banner) {
if (type.indexOf('=') >= 0) throw new Error(`Invalid banner file type: ${type}`)
flags.push(`--banner:${type}=${validateStringValue(banner[type], 'banner', type)}`)
}
}
if (footer) {
for (let type in footer) {
if (type.indexOf('=') >= 0) throw new Error(`Invalid footer file type: ${type}`)
flags.push(`--footer:${type}=${validateStringValue(footer[type], 'footer', type)}`)
}
}
if (inject) for (let path of inject) flags.push(`--inject:${validateStringValue(path, 'inject')}`)
if (loader) {
for (let ext in loader) {
if (ext.indexOf('=') >= 0) throw new Error(`Invalid loader extension: ${ext}`)
flags.push(`--loader:${ext}=${validateStringValue(loader[ext], 'loader', ext)}`)
}
}
if (outExtension) {
for (let ext in outExtension) {
if (ext.indexOf('=') >= 0) throw new Error(`Invalid out extension: ${ext}`)
flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], 'out extension', ext)}`)
}
}
if (entryPoints) {View on GitHub (pinned to f6058f8364)