Skip to content
Latchkey

Qwik build fails when qwikVite plugin is missing in CI

Qwik builds through Vite using the qwikVite() plugin (plus qwikCity() for routing). If they are missing or misordered in vite.config, the Qwik optimizer never processes $ boundaries and the build fails or ships a non-resumable bundle.

What this error means

A vite build step fails with a JSX or optimizer error, or the app loads but nothing is interactive, because qwikVite() was not registered in the Vite plugin array.

vite
error during build:
[vite]: Rollup failed to resolve import "@builder.io/qwik" from "src/root.tsx".
No Qwik optimizer plugin found in the Vite config.

Common causes

qwikVite is not in the plugin array

Without qwikVite(), Vite has no Qwik JSX transform or $ optimizer, so the build fails or produces a dead bundle.

Plugin order or the routing plugin is wrong

qwikCity() must come before qwikVite(); a wrong order or a missing routing plugin breaks the build.

How to fix it

Register the Qwik Vite plugins

  1. Add qwikCity() then qwikVite() to the Vite plugins array.
  2. Install @builder.io/qwik and @builder.io/qwik-city as dependencies.
  3. Re-run vite build to confirm the optimizer runs.
vite.config.ts
import { defineConfig } from 'vite';
import { qwikVite } from '@builder.io/qwik/optimizer';
import { qwikCity } from '@builder.io/qwik-city/vite';

export default defineConfig({
  plugins: [qwikCity(), qwikVite()],
});

Pin the plugin versions

Commit the lockfile so CI uses the same Qwik plugin versions as local.

Terminal
git add package-lock.json

How to prevent it

  • Keep qwikCity() before qwikVite() in vite.config.
  • Install the Qwik packages as dependencies.
  • Commit the lockfile so plugin versions match in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →