Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Workers importmap field #11002

Open
WebReflection opened this issue Feb 5, 2025 · 1 comment
Open

Web Workers importmap field #11002

WebReflection opened this issue Feb 5, 2025 · 1 comment

Comments

@WebReflection
Copy link
Contributor

WebReflection commented Feb 5, 2025

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

@robbiespeed
Copy link

Some discussion already here: WICG/import-maps#2
And a draft PR: #10858

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants