fix(sidebar): hide Analytics via toggle

This commit is contained in:
2026-06-22 18:02:24 +09:30
parent e3ec6c80d0
commit f570e47e27
14 changed files with 334 additions and 109 deletions
+29
View File
@@ -0,0 +1,29 @@
import type { Plugin } from "vite";
/**
* Vite's default base (`/`) emits absolute chunk paths like `/assets/chunk.js`.
* In content scripts those resolve against the SEQTA page origin on Firefox,
* not the extension — causing MIME type / NS_ERROR_CORRUPTED_CONTENT failures.
*
* Use relative base plus `chrome.runtime.getURL` for dynamic import targets.
*/
export function extensionChunkUrls(): Plugin {
return {
name: "extension-chunk-urls",
config() {
return {
base: "./",
experimental: {
renderBuiltUrl(filename, { hostType, type }) {
if (type === "chunk" && hostType === "js") {
const path = filename.replace(/^\//, "");
return {
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
};
}
},
},
};
},
};
}