mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
refactor: trim PR debloat and fix transformers build
Extract shared helpers for home notices, timetable subtitles, and theme images; dedupe global search, Select, and build scripts while preserving behaviour. Add @huggingface/transformers as a direct dependency and resolve ORT WASM paths via require.resolve so pnpm postinstall and Vite can bundle vector search. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
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.
|
||||
*/
|
||||
/** Relative chunk/CSS URLs via chrome.runtime.getURL for content-script dynamic imports. */
|
||||
export function extensionChunkUrls(): Plugin {
|
||||
return {
|
||||
name: "extension-chunk-urls",
|
||||
@@ -17,16 +11,11 @@ export function extensionChunkUrls(): Plugin {
|
||||
renderBuiltUrl(filename, { hostType, type }) {
|
||||
const path = filename.replace(/^\//, "");
|
||||
if (type === "chunk" && hostType === "js") {
|
||||
return {
|
||||
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
|
||||
};
|
||||
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.
|
||||
// JS-triggered CSS preloads only — extension HTML pages need static hrefs.
|
||||
if (type === "asset" && hostType === "js" && path.endsWith(".css")) {
|
||||
return {
|
||||
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
|
||||
};
|
||||
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user