From ec0e10173a7f4f163ed988e19cb82f91ac64cbda Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 22 Aug 2024 01:15:31 +0800 Subject: [PATCH] fix(manifest): set the `persistent` to `undefined` when in firefox Setting `persistent` to true in Manifest V3 results in an error in Firefox https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background --- src/manifest.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/manifest.ts b/src/manifest.ts index 03e55a5e..51f35a56 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -23,9 +23,13 @@ export async function getManifest() { // page: './dist/options/index.html', // open_in_tab: true, // }, + + // Setting `persistent` to true in Manifest V3 results in an error in Firefox + // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background background: (isFirefox || isSafari) - ? { scripts: ['./dist/background/index.js'], persistent: false } + ? { scripts: ['./dist/background/index.js'], persistent: isFirefox ? undefined : false } : { service_worker: './dist/background/index.js' }, + icons: { 16: './assets/icon-512.png', 48: './assets/icon-512.png',