vite build on a CRXJS extension project and got:
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
-
Update
@crxjs/vite-pluginto the latest release (2.7.0 or newer), which supports Vite 8 / Rolldown: -
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
?scriptsuffix (double-registration is the most common remaining edge case). -
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.

