quasarframework/quasar · error · Error
Failed to load Quasar auto-import data
Error message
Failed to load Quasar auto-import data
What it means
The Quasar Vite plugin loads Quasar's component/directive auto-import metadata from `<quasar package>/dist/transforms/auto-import.json`. If that read/parse fails (missing file, unreadable path, corrupted JSON, or the quasar package itself unresolvable), it rethrows as 'Failed to load Quasar auto-import data' with the original error as `cause`. Without this data the plugin cannot rewrite `import { QBtn } from 'quasar'` style imports.
Source
Thrown at vite-plugin/src/auto-import-data.js:18
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { quasarPath } from './quasar-path.js'
let autoImportData
export function loadAutoImportData() {
if (autoImportData === void 0) {
try {
autoImportData = JSON.parse(
readFileSync(
join(quasarPath, 'dist/transforms/auto-import.json'),
'utf8'
)
)
} catch (err) {
throw new Error('Failed to load Quasar auto-import data', { cause: err })
}
}
return autoImportData
}
View on GitHub (pinned to 4841521b5f)
Solutions
- Reinstall dependencies cleanly: delete node_modules and the lockfile entries for quasar, then `pnpm install` (or `npm ci`).
- Verify the file exists: check `node_modules/quasar/dist/transforms/auto-import.json`; if missing, the quasar package is broken.
- Ensure the `quasar` package version matches the vite-plugin version expected by your app-vite version (mismatched majors can change shipped files).
- Inspect `err.cause` in the stack — it names the real failure (ENOENT vs JSON syntax) to pinpoint whether it's a missing file or corruption.
Example fix
# before: broken install Error: Failed to load Quasar auto-import data (ENOENT .../quasar/dist/transforms/auto-import.json) # after rm -rf node_modules && pnpm install
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'node:fs'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const quasarPath = require.resolve('quasar').replace(/([\\/])dist([\\/]).*$/, '')
if (!existsSync(`${quasarPath}/dist/transforms/auto-import.json`)) {
console.error('quasar package is broken: auto-import.json missing; reinstall dependencies')
} Try / catch
try {
await viteBuild()
} catch (err) {
if (err.message === 'Failed to load Quasar auto-import data') {
console.error('Quasar install broken; run: rm -rf node_modules && pnpm install', { cause: err.cause })
} else throw err
} Prevention
- Use a lockfile and `npm ci`/frozen pnpm installs so node_modules is never partially populated.
- Avoid caching node_modules across CI runs without integrity checks.
- Keep quasar and @quasar/vite-plugin versions in lockstep.
- When the error appears, read err.cause — ENOENT means reinstall, JSON parse error means corruption.
When it happens
Trigger: Running vite dev/build when the installed quasar package lacks dist/transforms/auto-import.json — broken or partial install (interrupted pnpm/npm install), corrupted node_modules, quasar resolution picking the wrong path, or a version mismatch where the installed quasar build doesn't ship transforms.
Common situations: Fresh clone where dependencies installed partially; CI cache that stashed a truncated quasar package; deleting/rebuilding node_modules mid-run; using a patched or hoisted monorepo layout where `quasar` resolves unexpectedly.
Related errors
- Failed to load Quasar import map
- Unknown import from Quasar: ${importName}
- [Quasar] In your Vite config file, please add the Quasar plu
- [Quasar] "${id}" contains an import from "quasar" that could
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/7dca091e38fff959.
Report an issue: GitHub.