-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Supporting import maps in worker environments #8173
Copy link
Copy link
Open
Labels
topic: imports/exportsImport maps, specifiers, imports, exportsImport maps, specifiers, imports, exports
Description
I'd like to propose we work towards a solution for providing import maps to worker environments.
Currently new Worker(..., { type: 'module' }) will run in a unique resolution environment that does not provide access to the import maps present in the parent page.
Bringing the benefits of import maps to workers would be a worthwhile effort.
I would like to propose that the API support the following capabilities:
- The ability to instantiate a
Workersuch that it shares the import map of the parent resolution environment. - The ability to instantiate a
Workerwith a custom import map JSON object. - Optionally, but not necessarily, the ability to update the import map of a worker after the worker is initialized.
- Extending these options not only to
Workerbut also toSharedWorkerandWorkletinitializations.
If there is rough agreement on this direction, and some of the above requirements, perhaps we can start to sketch out an API with an eye towards a PR soon? I think it would be really good to get this moving at this point in time so that users can benefit from import maps outside of the main thread.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: imports/exportsImport maps, specifiers, imports, exportsImport maps, specifiers, imports, exports