mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 09:11:06 +00:00
fix(global search): CSS preload killed plugin load
This commit is contained in:
@@ -15,8 +15,15 @@ export function extensionChunkUrls(): Plugin {
|
||||
base: "./",
|
||||
experimental: {
|
||||
renderBuiltUrl(filename, { hostType, type }) {
|
||||
const path = filename.replace(/^\//, "");
|
||||
if (type === "chunk" && hostType === "js") {
|
||||
const path = filename.replace(/^\//, "");
|
||||
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.
|
||||
if (type === "asset" && hostType === "js" && path.endsWith(".css")) {
|
||||
return {
|
||||
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
|
||||
};
|
||||
|
||||
+6
-5
@@ -43,12 +43,13 @@ export default function InlineWorkerDevPlugin(): Plugin {
|
||||
// Note: Original code had `await fs.readFile(cleanPath, "utf-8");` but `code` wasn't used.
|
||||
// `esbuild` directly takes `cleanPath` as an entry point.
|
||||
const result = await build({
|
||||
entryPoints: [cleanPath], // esbuild uses the file path directly
|
||||
entryPoints: [cleanPath],
|
||||
bundle: true,
|
||||
write: false, // We want the output in memory, not written to disk
|
||||
platform: "browser", // Target environment for the worker code
|
||||
format: "iife", // Immediately Invoked Function Expression, suitable for workers
|
||||
target: "esnext", // Transpile to modern JavaScript
|
||||
write: false,
|
||||
platform: "browser",
|
||||
format: "iife",
|
||||
target: "esnext",
|
||||
external: ["webextension-polyfill"],
|
||||
});
|
||||
|
||||
const workerCode = result.outputFiles[0].text;
|
||||
|
||||
Reference in New Issue
Block a user