Skip to main content
You ran vite build on a CRXJS extension project and got:
The build fails before the manifest is written, and the path in the error points to a file that exists in your project. Here is what it means and how to fix it.

What the error means

@crxjs/vite-plugin resolves each content script to its emitted output file during the crx:manifest-post step (in generateBundle). If the plugin cannot match your content-script source to an output chunk (because of how that chunk is named or keyed), the filename comes back undefined and the plugin throws. It is not “your file does not exist”; it is the plugin and the bundler disagreeing about the emitted chunk for your content script.

Is this a Vite 8 / Rolldown problem?

Mostly historical. Vite 8 switched its default bundler from Rollup to Rolldown, and CRXJS needed compatibility work for that transition (see #1042 and #1067). That work landed: @crxjs/vite-plugin now supports Vite 8 (#1132). On current versions (@crxjs/vite-plugin@2.7.0 with Vite 8) this error does not reproduce in common setups, including a content script that is also imported with ?script. The original report (#883) was on Vite 5 with SolidStart/vinxi, not Rolldown.

How to fix it

  1. Update @crxjs/vite-plugin to the latest release (2.7.0 or newer), which supports Vite 8 / Rolldown:
  2. Check how the manifest references the script. Use a root-relative path that matches your project, and confirm the same file is not also imported elsewhere with a ?script suffix (double-registration is the most common remaining edge case).
  3. If you cannot upgrade yet, pinning vite@^7 (still Rollup-based) is a temporary unblock until you can move to a current @crxjs/vite-plugin.
If you still hit this on current versions, the maintainers are responsive, so open an issue with a minimal reproduction at crxjs/chrome-extension-tools.