I'm using tsdav, which itself depends on cross-fetch in a service worker of a webextension, which is bundled with Vite.
However, it seems that when the service worker is being bundled, cross-fetch does not work well.
An outputs the following error: TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation
Hi!
I'm using tsdav, which itself depends on cross-fetch in a service worker of a webextension, which is bundled with Vite. However, it seems that when the service worker is being bundled, cross-fetch does not work well.
An outputs the following error: TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation
Many thanks!
package.json
vite.config
background-script
import browser from 'webextension-polyfill'; import { DAVClient } from 'tsdav'; import { createEvent } from 'ics'; import _ from 'lodash'; // import { DateTime } from "luxon";
console.log('Background Script');