fix: Vite 8 (Rolldown) compatibility for content scripts#1149
fix: Vite 8 (Rolldown) compatibility for content scripts#1149sheldhur wants to merge 1 commit intocrxjs:mainfrom
Conversation
Made-with: Cursor
|
|
@Toumash can you look at this? I can update the failed tests if you're ready to merge it |
|
I'm not sure if it's the same issue or not (I've haven't dug into it yet), but I also had an issue where I had a content script and service_worker script both named I'm using Vite 8. |
Summary
Two fixes for Vite 8 (Rolldown) compatibility when building Chrome extensions with content scripts:
Duplicate refIds:
this.emitFile({ type: "chunk", name: basename(file) })returns the samerefIdfor different files with the same basename (e.g.seller/content.tsx,cmp/content.tsx,marketplace/content.tsx). Only the first script gets itsfileNameresolved; the rest fail withContent script fileName is undefined.Wrong MAIN world loader path: The loader uses
./${fileName.split("/").at(-1)}which loses the subdirectory, producing a broken path.