WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.66k stars 69 forks source link

How do we install import maps in worker/worklet contexts? #2

Open domenic opened 6 years ago

domenic commented 6 years ago

It's unclear how to apply import maps to a worker. There are essentially three categories of approach I can think of:

The worker-creator specified import map is a bit strange:

Basically, there is no clear translation of <script type="importmap"> into a worker setting.

Also, as pointed out below, anything where the creator controls the import map works poorly for service worker updates.

The worker itself specifying seems basically unworkable, for reasons discussed below.

And the header-based mechanism is hard to develop against and deploy.

Original post, for posterity, including references to the old "package name map" name We have a sketch of an idea for how to supply a package name map to a worker: ```js new Worker(someURL, { type: "module", packageMap: ... }); ``` This is interesting to contrast with the mechanism for window contexts proposed currently (and discussed in #1): - It's unlike the Window-context mechanism in that the creator of the realm controls the realm's module resolution, instead of the realm itself - It's like the Window-context mechanism in that the script that runs in the realm does not control the realm's module resolution; the control is external to the script itself. Basically, there is no clear translation of ` Githubissues.
  • Githubissues is a development platform for aggregating issues.