{"record":{"id":"40fdcfa32bd57559","repo":"evanw/esbuild","slug":"invalid-out-extension-ext","errorCode":null,"errorMessage":"Invalid out extension: ${ext}","messagePattern":"Invalid out extension: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/shared/common.ts","lineNumber":341,"sourceCode":"      flags.push(`--banner:${type}=${validateStringValue(banner[type], 'banner', type)}`)\n    }\n  }\n  if (footer) {\n    for (let type in footer) {\n      if (type.indexOf('=') >= 0) throw new Error(`Invalid footer file type: ${type}`)\n      flags.push(`--footer:${type}=${validateStringValue(footer[type], 'footer', type)}`)\n    }\n  }\n  if (inject) for (let path of inject) flags.push(`--inject:${validateStringValue(path, 'inject')}`)\n  if (loader) {\n    for (let ext in loader) {\n      if (ext.indexOf('=') >= 0) throw new Error(`Invalid loader extension: ${ext}`)\n      flags.push(`--loader:${ext}=${validateStringValue(loader[ext], 'loader', ext)}`)\n    }\n  }\n  if (outExtension) {\n    for (let ext in outExtension) {\n      if (ext.indexOf('=') >= 0) throw new Error(`Invalid out extension: ${ext}`)\n      flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], 'out extension', ext)}`)\n    }\n  }\n\n  if (entryPoints) {\n    if (Array.isArray(entryPoints)) {\n      for (let i = 0, n = entryPoints.length; i < n; i++) {\n        let entryPoint = entryPoints[i]\n        if (typeof entryPoint === 'object' && entryPoint !== null) {\n          let entryPointKeys: OptionKeys = Object.create(null)\n          let input = getFlag(entryPoint, entryPointKeys, 'in', mustBeString)\n          let output = getFlag(entryPoint, entryPointKeys, 'out', mustBeString)\n          checkForInvalidFlags(entryPoint, entryPointKeys, 'in entry point at index ' + i)\n          if (input === undefined) throw new Error('Missing property \"in\" for entry point at index ' + i)\n          if (output === undefined) throw new Error('Missing property \"out\" for entry point at index ' + i)\n          entries.push([output, input])\n        } else {\n          entries.push(['', validateStringValue(entryPoint, 'entry point at index ' + i)])","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/evanw/esbuild/blob/f6058f8364fe7ab91ca57a83e02577ed74c9cae4/lib/shared/common.ts#L323-L359","documentation":"The `outExtension` option is a map of output type to extension, serialized as `--out-extension:TYPE=EXT`. An '=' inside the TYPE breaks parsing, so esbuild rejects it at lib/shared/common.ts:341. Valid types are '.js' and '.css'.","triggerScenarios":"Passing `outExtension: { '.js=x': '.mjs' }` or any outExtension key containing '='.","commonSituations":"Typo or generated key; confusion between the type key ('.js'/'.css') and the value.","solutions":["Use a valid output type key without '=' (either '.js' or '.css').","Strip '=' from generated keys."],"exampleFix":"// before\nawait build({ entryPoints: ['app.ts'], outExtension: { '.js=x': '.mjs' } })\n\n// after\nawait build({ entryPoints: ['app.ts'], outExtension: { '.js': '.mjs' } })","handlingStrategy":"validation","validationCode":"const VALID_OUTEXT_TYPES = new Set(['.js', '.css'])\nfunction assertOutExtKeys(map) {\n  for (const k of Object.keys(map ?? {})) {\n    if (!VALID_OUTEXT_TYPES.has(k)) throw new Error(`outExtension key must be '.js' or '.css', got ${k}`)\n  }\n}\nassertOutExtKeys(options.outExtension)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict outExtension keys to '.js' or '.css'.","Put the desired extension (e.g. '.mjs') in the value, not the key.","Don't embed '=' in outExtension keys."],"tags":["config","validation","out-extension"],"backgroundTag":null,"analyzedSha":"f6058f8364fe7ab91ca57a83e02577ed74c9cae4","analyzedAt":"2026-08-09T18:37:22.223Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}