{"record":{"id":"22316e51b5a00040","repo":"quasarframework/quasar","slug":"failed-to-load-quasar-import-map","errorCode":null,"errorMessage":"Failed to load Quasar import map","messagePattern":"Failed to load Quasar import map","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"vite-plugin/src/js-transform.js","lineNumber":16,"sourceCode":"import { readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { parseSync } from 'vite'\n\nimport { quasarPath } from './quasar-path.js'\n\nlet quasarImportMap\nexport function loadQuasarImportMap() {\n  if (quasarImportMap !== void 0) return\n\n  try {\n    quasarImportMap = JSON.parse(\n      readFileSync(join(quasarPath, 'dist/transforms/import-map.json'), 'utf8')\n    )\n  } catch (err) {\n    throw new Error('Failed to load Quasar import map', { cause: err })\n  }\n}\n\nconst importQuasarRegex = /import\\s*\\{([^}]*)\\}\\s*from\\s*(['\"])quasar\\2;?/g\nconst stripCommentsRegex = /\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g\n\n/**\n * Textual pre-filter for imports (or exports) from the \"quasar\" package\n * that survived the transformations — static, re-export or dynamic form.\n * Can false-positive on string content (e.g. documentation snippets),\n * so a match must be confirmed by hasResidualQuasarImports().\n */\nexport const residualQuasarImportRegex =\n  /from\\s*(['\"])quasar\\1|import\\s*\\(\\s*(['\"])quasar\\2\\s*\\)/\n\nconst dynamicResidualRegex = /import\\s*\\(\\s*(['\"])quasar\\1\\s*\\)/\n\nconst staticQuasarImportNodeTypes = new Set([","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/vite-plugin/src/js-transform.js#L1-L34","documentation":"The Quasar Vite plugin caches an import map read from `<quasar package>/dist/transforms/import-map.json`, which maps named Quasar exports to their build files. If reading/parsing that file fails, loadQuasarImportMap() rethrows 'Failed to load Quasar import map' with the underlying error as `cause`. This runs at configResolved time, so dev server startup or build fails immediately.","triggerScenarios":"vite dev/build startup when `quasar` resolves but its dist/transforms/import-map.json is missing, unreadable, or invalid JSON — typically a broken/partial quasar package install or an incompatible quasar package version.","commonSituations":"Interrupted installs leaving a truncated quasar dist; stale CI dependency caches; monorepo linking quirks where `quasar` resolves to a source checkout without a built dist; version drift between quasar and @quasar/vite-plugin.","solutions":["Clean reinstall: remove node_modules (and quasar's lockfile entry) and run `pnpm install` / `npm ci` again.","Confirm `node_modules/quasar/dist/transforms/import-map.json` exists and parses; rebuild the quasar package if you're linking a local checkout.","Align versions: use matching quasar and @quasar/vite-plugin releases (check both changelogs for breaking transform-file changes).","Read `err.cause` from the stack trace to distinguish ENOENT (missing file) from a JSON parse error (corrupt content)."],"exampleFix":"# before, when linking local quasar for development\ndevDependencies: { quasar: 'file:../ui' }  # dist never built\n\n# after: build it first\npnpm --dir ../ui build && pnpm install","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nconst mapPath = join(quasarPath, 'dist/transforms/import-map.json')\nif (!existsSync(mapPath)) {\n  throw new Error(`quasar package incomplete: ${mapPath} missing; run a clean reinstall or build quasar dist`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  startViteDevServer()\n} catch (err) {\n  if (err.message === 'Failed to load Quasar import map') {\n    console.error('Reinstall quasar (broken dist) or rebuild your local quasar checkout', err.cause)\n    process.exit(1)\n  }\n  throw err\n}","preventionTips":["When linking a local quasar checkout, always build its dist before starting the dev server.","Pin matching versions of quasar and @quasar/vite-plugin.","Verify import-map.json exists after every dependency install in CI.","Inspect err.cause to distinguish a missing file from corrupt JSON."],"tags":["vite-plugin","import-map","installation","node-modules"],"backgroundTag":"missing-generated-file","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}