Skip to content

Supporting import maps in worker environments #8173

Open

Description

@guybedford

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 Worker such that it shares the import map of the parent resolution environment.
  • The ability to instantiate a Worker with 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 Worker but also to SharedWorker and Worklet initializations.

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.

Activity

  1. domenic commented on Aug 9, 2022

    @domenic
    Member

    Let's keep this discussion in WICG/import-maps#2 since import maps is not yet part of HTML.

  2. added
    topic: imports/exports
    on Feb 14, 2026
  3. LeaVerou commented on Feb 14, 2026

    @LeaVerou
    Member

    Let's keep this discussion in WICG/import-maps#2 since import maps is not yet part of HTML.

    Now that they are and https://github.com/WICG/import-maps/ is archived, should we reopen this? (or #11002 which was about the same thing)
    There is currently no open issue tracking this problem, only a (stalled) PR: #10858

  4. reopened this on Feb 14, 2026
  5. added
    topic: workers and worklets
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: imports/exportstopic: workers and worklets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions