Skip to content

Build your personal knowledge base with Trilium Notes

fix(clipper): start the dev browsers on a fresh checkout and with the Firefox snap

Elian Doran4ff86807c986
diff --git a/apps/web-clipper/wxt.config.ts b/apps/web-clipper/wxt.config.ts
index 5bdcf3d4ee..4a27b5c8fb 100644
--- a/apps/web-clipper/wxt.config.ts
+++ b/apps/web-clipper/wxt.config.ts
@@ -1,3 +1,4 @@
+import { mkdirSync } from "fs";
import { copyFile, readFile, rm, writeFile } from "fs/promises";
import JSZip from "jszip";
import { resolve } from "path";
@@ -8,7 +9,9 @@ let originalTsConfig: object;
export default defineConfig({
webExt: {
// A persistent profile keeps the toolbar pin and the extension's settings across dev runs.
- chromiumProfile: resolve(".wxt/chrome-data"),
+ // The Firefox one is not in /tmp, where web-ext puts it by default and the Firefox snap cannot read it.
+ chromiumProfile: profileDir("chrome-data"),
+ firefoxProfile: profileDir("firefox-data"),
keepProfileChanges: true
},
vite: () => ({
@@ -117,3 +120,10 @@ export default defineConfig({
}
}
});
+
+/** A dev browser profile in `.wxt`, created if missing: neither browser's launcher creates it. */
+function profileDir(name: string) {
+ const dir = resolve(".wxt", name);
+ mkdirSync(dir, { recursive: true });
+ return dir;
+}
diff --git a/docs/Developer Guide/Developer Guide/Concepts/Web Clipper.md b/docs/Developer Guide/Developer Guide/Concepts/Web Clipper.md
index 503bba6420..bcad932b41 100644
--- a/docs/Developer Guide/Developer Guide/Concepts/Web Clipper.md
+++ b/docs/Developer Guide/Developer Guide/Concepts/Web Clipper.md
@@ -14,7 +14,7 @@ WXT allows easy development of the plugin, with full TypeScript support and live
* Run `pnpm --filter web-clipper dev` to enter dev mode for Chrome (with manifest v3).
* Run `pnpm --filter web-clipper dev:firefox` to enter dev mode for Firefox (with manifest v2).
-This will open a separate browser instance in which the extension is automatically injected.
+This will open a separate browser instance in which the extension is automatically injected. Its profile is kept in `apps/web-clipper/.wxt/chrome-data` or `.wxt/firefox-data`, so the extension's settings and its toolbar button stay between runs; delete the folder to start with a fresh profile.
> [!NOTE]
> On NixOS, the same development commands work just fine. Just make sure the browser is available in the system path: