I am building a Chrome extension using Manifest Version 3, which uses Service Workers as the replacement for background pages. I spent a few days earlier this month trying to understand why import
wasn't working, till it turns out that service workers don't support import
yet. Obviously I can't add a <script>
tag either - service workers don't have a DOM to insert a tag into.
What's the best way to load third party code (like an NPM module or a .js
file) inside a service worker?