Use capacitor plugin in web worker

I’m offloading heavy calculations to a web worker. The web worker is all set up and integrated into my app.
But it can’t access capacitor plugins.

Importing any capacitor plugin causes the error message:
ReferenceError: window is not defined

Is there a way around this?

Some capacitor plugins probably really need access to window, or the dom. For example for storage.
But I’m actually only interested in calling custom native code.

Having the same needs as @lhk. I can get the Filesystem plugin to mostly work using a nasty hack self.window = self;
inside the web workers.

However now Capacitor thinks we’re on the web even on iOS, isNativePlatform is always false probably due to some missing initialization