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.
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
- Add
qwikCity()thenqwikVite()to the Vitepluginsarray. - Install
@builder.io/qwikand@builder.io/qwik-cityas dependencies. - Re-run
vite buildto confirm the optimizer runs.
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.
git add package-lock.jsonHow to prevent it
- Keep
qwikCity()beforeqwikVite()invite.config. - Install the Qwik packages as dependencies.
- Commit the lockfile so plugin versions match in CI.