fix(global search): CSS preload killed plugin load

This commit is contained in:
2026-06-27 15:10:24 +09:30
parent 1045d38f47
commit 3213d0ca28
29 changed files with 327 additions and 62 deletions
+8 -1
View File
@@ -15,8 +15,15 @@ export function extensionChunkUrls(): Plugin {
base: "./",
experimental: {
renderBuiltUrl(filename, { hostType, type }) {
const path = filename.replace(/^\//, "");
if (type === "chunk" && hostType === "js") {
const path = filename.replace(/^\//, "");
return {
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
};
}
// Rewrite CSS preloads from JS dynamic imports (content scripts).
// Do not rewrite hostType "css" — extension HTML pages need static hrefs.
if (type === "asset" && hostType === "js" && path.endsWith(".css")) {
return {
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
};