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
This commit is contained in:
Hakadao
2024-08-22 01:15:31 +08:00
parent f9108203b7
commit ec0e10173a

View File

@@ -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',