I’m trying to detect if the browser supports es modules import from a Service Worker.
To be clear, I’m not trying to import es modules from the SW, I’m trying to programatically detect from the SW if the browser can import es modules scripts.
I’ve tried using
'noModule' in HTMLScriptElement.prototype or
document.currentScript && "noModule" in document.currentScript; but both HTMLScriptElement and document are undefined in the SW context.
Is there a way to do that which does not involve sending a message to the worker ?