mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
4fda63dedd
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>
26 lines
879 B
TypeScript
26 lines
879 B
TypeScript
import type { Plugin } from "vite";
|
|
|
|
/** Relative chunk/CSS URLs via chrome.runtime.getURL for content-script dynamic imports. */
|
|
export function extensionChunkUrls(): Plugin {
|
|
return {
|
|
name: "extension-chunk-urls",
|
|
config() {
|
|
return {
|
|
base: "./",
|
|
experimental: {
|
|
renderBuiltUrl(filename, { hostType, type }) {
|
|
const path = filename.replace(/^\//, "");
|
|
if (type === "chunk" && hostType === "js") {
|
|
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
|
|
}
|
|
// 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)})` };
|
|
}
|
|
},
|
|
},
|
|
};
|
|
},
|
|
};
|
|
}
|