feat: optimisations

This commit is contained in:
2026-07-19 18:08:52 +09:30
parent 10db972ef4
commit 824cedca2f
63 changed files with 1098 additions and 1719 deletions
-18
View File
@@ -10,8 +10,6 @@ import fixCrxWorkerLiveReload from "./lib/fixCrxWorkerLiveReload";
import { firefoxStripFunctionProbe } from "./lib/firefoxStripFunctionProbe";
import { extensionChunkUrls } from "./lib/extensionChunkUrls";
import million from "million/compiler";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { chrome } from "./src/manifests/chrome";
@@ -57,9 +55,6 @@ function withDevManifestCsp(manifest: Manifest, command: string): Manifest {
const mode = process.env.MODE || "chrome"; // Check the environment variable to determine which build type to use.
//const sourcemap = (process.env.SOURCEMAP === "true") || false; // Check whether we want sourcemaps.
/** Million's compiler can emit `new Function()`, which Firefox extension pages block (strict CSP, no unsafe-eval). */
const useMillion = mode.toLowerCase() !== "firefox";
const repoRoot = __dirname;
export default defineConfig(({ command, mode: viteMode }) => {
@@ -89,19 +84,6 @@ export default defineConfig(({ command, mode: viteMode }) => {
extensionChunkUrls(),
base64Loader,
InlineWorkerPlugin(),
...(useMillion && command !== "build"
? [
million.vite({
auto: true,
filter: {
exclude: [
"**/*.svelte",
"node_modules/**/*.{jsx,tsx,ts,js,mjs,cjs}",
],
},
}),
]
: []),
crx({
manifest: withDevManifestCsp(
targets.find((t) => t.browser === mode.toLowerCase())?.manifest ??