mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 09:11:06 +00:00
fix(sidebar): hide Analytics via toggle
This commit is contained in:
@@ -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)})`,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user