quasarframework/quasar · warning
[Quasar] "${id}" contains an import from "quasar" that could
Error message
[Quasar] "${id}" contains an import from "quasar" that could not be transformed into per-file imports, so the full Quasar bundle may end up in your build output What it means
The Quasar vite-plugin transforms bare 'quasar' imports into per-file imports for tree-shaking. warnResidualImports is invoked from the transform pipeline when, after transformation, a module still contains imports from 'quasar' that could not be resolved to per-file imports; it reports through Rollup's this.warn() when a transform context is available. The build continues, but the full Quasar bundle may be pulled into the output, inflating bundle size.
Source
Thrown at vite-plugin/src/plugin.js:138
const vueMatcher = createExtMatcher(opts.autoImportVueExtensions)
const scriptMatcher = createExtMatcher(opts.autoImportScriptExtensions)
const warnedFiles = new Set()
function warnResidualImports(ctx, code, id) {
if (
useTreeshaking &&
!warnedFiles.has(id) &&
hasResidualQuasarImports(code, id)
) {
warnedFiles.add(id)
const msg =
`[Quasar] "${id}" contains an import from "quasar" that could not be` +
' transformed into per-file imports, so the full Quasar bundle may' +
' end up in your build output'
if (ctx !== void 0 && typeof ctx.warn === 'function') {
ctx.warn(msg)
} else {
console.warn(msg)
}
}
}
function transformHandler(src, id) {
// when hook filters are not available, this mirrors their fast bail out
if (!quasarCodeRegex.test(src)) {
return null
}
const is = parseViteRequest(id)
// the regex fallback post-processes the compiled render code,
// so template requests need their own handling there
if (astAutoImportActive === false && is.template(vueMatcher)) {
const code = vueTransform(View on GitHub (pinned to 4841521b5f)
Solutions
- Change the offending import to explicit per-file imports, e.g. import { QBtn } from 'quasar' (statically analyzable named imports)
- Check the plugin configuration (quasar vite-plugin options/auto-import settings) so components/directives/styles are covered
- Inspect the file named in the message and remove dynamic/ambiguous quasar imports; if intentional, accept the warning knowing full-bundle cost
Example fix
// before
const QBtn = (await import('quasar')).QBtn
// after
import { QBtn } from 'quasar'
// or use quasar/wrappers per-component pattern per plugin docs Defensive patterns
Strategy: validation
Validate before calling
// build-time guard: fail the build on residual quasar imports
export default defineConfig(({ vite }) => ({
build: { rollupOptions: {
onwarn(warning, warn) {
if (warning.code === 'PLUGIN_WARNING' && /could not be\s+transformed into per-file imports/.test(warning.message)) {
throw new Error('Residual quasar import: ' + warning.message)
}
warn(warning)
}
}}
})) Try / catch
try {
await build(config)
} catch (e) {
if (/could not be transformed into per-file imports/.test(String(e))) {
console.error('Fix dynamic quasar imports to named static imports')
}
throw e
} Prevention
- Use static named imports from 'quasar' only
- Avoid dynamic import('quasar') and wildcard re-exports
- Audit bundle output size regularly to catch full-bundle regressions
When it happens
Trigger: A project file (id) imports from 'quasar' in a way the transformer cannot statically rewrite (dynamic imports, re-exports through non-analyzable code, or imports from dependencies bundling quasar), and the plugin has a Rollup/NormalizedName context to warn through.
Common situations: Importing quasar dynamically (`await import('quasar')`), importing from a library that itself re-exports quasar, or config options that bypass auto-import component/style transforms.
Related errors
- Unknown import from Quasar: ${importName}
- Failed to load Quasar auto-import data
- Failed to load Quasar import map
- [Quasar] In your Vite config file, please add the Quasar plu
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/85691e2f5cf40020.
Report an issue: GitHub.