vitejs/vite · error · Error
Unsupported configLoader: ${configLoader}. Accepted values a
Error message
Unsupported configLoader: ${configLoader}. Accepted values are 'bundle', 'runner', and 'native'. What it means
In loadConfigFromFile (config.ts:2376-2384), the configLoader parameter must be one of 'bundle', 'runner', or 'native'. Any other value throws. These select how the config file is loaded: bundled with esbuild, executed in a module runner, or natively imported.
Source
Thrown at packages/vite/src/node/config.ts:2381
export async function loadConfigFromFile(
configEnv: ConfigEnv,
configFile?: string,
configRoot: string = process.cwd(),
logLevel?: LogLevel,
customLogger?: Logger,
configLoader: 'bundle' | 'runner' | 'native' = 'bundle',
): Promise<{
path: string
config: UserConfig
dependencies: string[]
} | null> {
if (
configLoader !== 'bundle' &&
configLoader !== 'runner' &&
configLoader !== 'native'
) {
throw new Error(
`Unsupported configLoader: ${configLoader}. Accepted values are 'bundle', 'runner', and 'native'.`,
)
}
const start = performance.now()
const getTime = () => `${(performance.now() - start).toFixed(2)}ms`
let resolvedPath: string | undefined
if (configFile) {
// explicit config path is always resolved from cwd
resolvedPath = path.resolve(configFile)
} else {
// implicit config file loaded from inline root (if present)
// otherwise from cwd
for (const filename of DEFAULT_CONFIG_FILES) {
const filePath = path.resolve(configRoot, filename)
if (!fs.existsSync(filePath)) continueView on GitHub (pinned to 89620f09af)
Solutions
- Use one of the accepted values: 'bundle' (default), 'runner', or 'native'.
- Check for typos in the CLI flag or inline config option.
- Leave configLoader unset to use the default 'bundle'.
Example fix
// before
createServer({ configLoader: 'esm' })
// after
createServer({ configLoader: 'bundle' }) Defensive patterns
Strategy: type-guard
Validate before calling
const VALID_LOADERS = ['bundle', 'runner', 'native'] as const
if (!VALID_LOADERS.includes(configLoader as any)) {
throw new Error(`Unsupported configLoader: ${configLoader}`)
} Type guard
function isConfigLoader(value: unknown): value is 'bundle' | 'runner' | 'native' {
return value === 'bundle' || value === 'runner' || value === 'native'
} Prevention
- Type configLoader as the union 'bundle' | 'runner' | 'native' to catch typos at compile time.
- Leave configLoader unset to accept the default 'bundle'.
- Watch for typos when passing the CLI --configLoader flag.
When it happens
Trigger: Passing an unsupported configLoader string via the JS API (loadConfigFromFile / createServer({ configLoader })) or CLI --configLoader flag, e.g. 'esm', 'require', or a typo like 'bundel'.
Common situations: Migrating from an older Vite with different loader names, typos in config, or passing a custom loader name that isn't supported.
Related errors
- `renderLegacyChunks` and `renderModernChunks` cannot be both
- Invalid environment name "${name}". Environment names must o
- `input` cannot contain glob characters. They are reserved, s
- Required environments configuration were stripped out in the
- The value passed to "base" option was malformed. It should b
AI-assisted analysis of vitejs/vite@89620f09af (2026-08-03).
Data as JSON: /data/errors/f8a122a985336c46.json.
Report an issue: GitHub.