vitejs/vite · error · AggregateError
oxc transform error
Error message
oxc transform error
What it means
Thrown by the dependency scanner when oxc's `transformSync` reports errors while transpiling a non-JS entry (TypeScript/JSX) before glob-import transformation. oxc is the fast JS parser Vite uses; syntax problems surface as an `AggregateError` wrapping each diagnostic. The original parse/transform errors are preserved inside the aggregate.
Source
Thrown at packages/vite/src/node/optimizer/scan.ts:431
id: path,
external: !entries.includes(path),
})
const doTransformGlobImport = async (
contents: string,
id: string,
loader: Loader,
) => {
let transpiledContents: string
// transpile because `transformGlobImport` only expects js
if (loader !== 'js') {
const result = transformSync(id, contents, {
...(jsxOptions !== undefined ? { jsx: jsxOptions } : {}),
lang: loader,
tsconfig: false,
})
if (result.errors.length > 0) {
throw new AggregateError(result.errors, 'oxc transform error')
}
transpiledContents = result.code
} else {
transpiledContents = contents
}
const result = await transformGlobImport(
transpiledContents,
id,
environment.config.root,
resolve,
)
return result?.s.toString() || transpiledContents
}
const scripts: Record<
string,View on GitHub (pinned to 89620f09af)
Solutions
- Open the file referenced by the scan entry and fix the reported syntax error(s).
- If using decorators or other experimental syntax, enable the corresponding option in your tsconfig or oxc jsx options.
- Remove the offending file from `optimizeDeps.entries` / `rolldownOptions.input` if it should not be scanned.
- Inspect `AggregateError.errors` to see each individual oxc diagnostic for the exact line/column.
Example fix
// before — entry file uses decorators without config
@Component()
class App {}
// after — enable in tsconfig.json
// "experimentalDecorators": true
@Component()
class App {} Defensive patterns
Strategy: try-catch
Validate before calling
import { transformSync } from 'oxc-transform';
function checkScannableSyntax(file) {
const code = readFileSync(file, 'utf8');
const lang = file.endsWith('.tsx') ? 'tsx' : file.endsWith('.ts') ? 'ts' : 'jsx';
const res = transformSync(file, code, { lang, tsconfig: false });
if (res.errors.length) throw new Error(res.errors[0].message);
}
// run over each scan entry before build Try / catch
try {
await transformGlobImport(code, id);
} catch (e) {
if (e instanceof AggregateError && e.message === 'oxc transform error') {
for (const inner of e.errors) console.error(id, inner.message);
}
throw e;
} Prevention
- Lint/typecheck all scan entries in CI before invoking Vite.
- Enable experimental syntax options in tsconfig if you use decorators/JSX.
- Keep `.ts`/`.tsx` entries valid modules that oxc can parse.
When it happens
Trigger: In `doTransformGlobImport`, when `loader !== 'js'`, the file contents are passed to `transformSync(id, contents, { lang: loader, ... })`. If `result.errors.length > 0` (invalid TS/JSX syntax, unsupported syntax for the configured loader, or a malformed file used as a scan entry), the AggregateError is thrown.
Common situations: A scan entry contains invalid TypeScript (e.g. experimental decorator syntax without enabling it), a `.tsx`/`.jsx` file with malformed JSX, a non-JS file accidentally listed as an entry, or a new TS syntax version that the bundled oxc version does not yet understand.
Related errors
- oxc transform error
- Failed to load `transformWithEsbuild`. It is deprecated and
- [module runner] "import.meta.glob" is statically replaced du
- failed to resolve rolldownOptions.input value: ${JSON.string
- [vite] transform failed for module '${url}'${importer ? ` im
AI-assisted analysis of vitejs/vite@89620f09af (2026-08-03).
Data as JSON: /data/errors/39ae53d343233a86.json.
Report an issue: GitHub.