Description
What is the issue with the HTML Standard?
I am not sure this is the place to discuss such feature request but basically Workers and importmap
don't cope well with each other.
The idea here is that, given a single <script type="importmap">
and its JSON context, such JSON context can be forwarded to either Worker or SharedWorker constructors through their initialization options
parameter.
const w = new Worker('./worker.js', { type: 'module', importmap: { ...that_one } })
As long story short, it's unfortunate only the main thread can benefit from importmap
but there's no way to propagate that map elsewhere, or create ad-hoc importmap for detached threads so I hope this issue/feature-request will be somehow addressed sooner than later, also because polyfills around this issue look ugly and full of 3rd party dependencies that do a bit too much to make bare imports work in environments where static import
is allowed, but no way to dictate how that works, is available as API.
Thanks