quasarframework/quasar · error · Error

Unknown import from Quasar: ${importName}

Error message

Unknown import from Quasar: ${importName}

What it means

importTransformation() looks up the imported name in Quasar's import map to rewrite `import { X } from 'quasar'` into a direct deep import (`quasar/<file>`). If the name isn't in the map — i.e. it isn't a real Quasar export — it throws 'Unknown import from Quasar'. This surfaces typos or imports of removed/renamed Quasar exports at build time instead of as runtime undefineds.

Source

Thrown at vite-plugin/src/js-transform.js:149

      node.source?.value === 'quasar' &&
      !isTypeOnlyNode(node)
    ) {
      return true
    }
  }

  // dynamic import("quasar") can appear anywhere, but the full AST
  // walk is only worth it when its textual form is present at all
  return (
    dynamicResidualRegex.test(code) &&
    containsQuasarDynamicImport(program.body) === true
  )
}

export function importTransformation(importName) {
  const file = quasarImportMap[importName]
  if (file === void 0) {
    throw new Error('Unknown import from Quasar: ' + importName)
  }
  return 'quasar/' + file
}

function countNewlines(str) {
  let acc = 0
  let index = -1

  while ((index = str.indexOf('\n', index + 1)) !== -1) {
    acc++
  }

  return acc
}

/**
 * Transforms JS code where importing from 'quasar' package
 * Example:

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Check the spelling against Quasar's docs — most cases are typos (QBtn, QDialog, useQuasar, etc.).
  2. Verify the export exists in your installed version: search `node_modules/quasar/dist/transforms/import-map.json` for the name; if absent it isn't exported by that version.
  3. If migrating, update removed/renamed imports per the Quasar upgrade guide to the current names.
  4. If the name should exist, refresh the quasar package (clean reinstall) so import-map.json matches your plugin version.

Example fix

// before
import { QLayoutHeader } from 'quasar'

// after (QLayoutHeader was removed; use QHeader/QToolbar inside QLayout)
import { QHeader, QToolbar } from 'quasar'
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from 'node:fs'
const map = JSON.parse(readFileSync('node_modules/quasar/dist/transforms/import-map.json', 'utf8'))
if (map[importName] === undefined) {
  console.warn(`'${importName}' is not exported by the installed quasar version`)
}

Type guard

function isQuasarExport(importName, map) {
  return Object.prototype.hasOwnProperty.call(map, importName)
}

Try / catch

try {
  build()
} catch (err) {
  const m = /Unknown import from Quasar: (.+)/.exec(err.message)
  if (m) {
    console.error(`Fix the import '${m[1]}' — check spelling or the Quasar upgrade guide`)
    process.exitCode = 1
  } else throw err
}

Prevention

When it happens

Trigger: Writing `import { QButon } from 'quasar'` (typo); importing an export removed/renamed in your Quasar version (e.g. an old component name); importing something that exists at runtime but is absent from the installed import-map.json (stale quasar package vs newer plugin expectations).

Common situations: Upgrading Quasar where an export was renamed or dropped; copy-pasted code from an old tutorial; IDE auto-import suggesting a non-existent name; mixing a locally built quasar dist with an older import map.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/6c5786daff5e73b7. Report an issue: GitHub.