Files
BetterSEQTA-Plus/lib/extensionChunkUrls.ts
AdenMGB 4fda63dedd 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>
2026-06-28 10:30:25 +09:30

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)})` };
}
},
},
};
},
};
}