Open Bug 2080251 Opened 1 month ago Updated 1 month ago

Vendor Lit as it's exported for web, rather than a single bundle

Categories

(Toolkit :: UI Widgets, task, P3)

task

Tracking

()

People

(Reporter: mstriemer, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

When on the web, teams will want to use the public Lit module rather than our patched version. When looking at docs for Lit they will show imports from that bundle too, which may be clearer for devs in Firefox to be consistent.

Vendor the Lit code into the same structure as is used on the web i.e. import { asyncAppend } from 'chrome://global/content/vendor/lit/directives/async-append.js' rather than chrome://global/content/vendor/lit.all.mjs

It's possible we could work around this in an export step, rewriting the single bundle imports into the expected path:

// Example workaround, prefer importing the individual files into the same structure if possible
// If we have this in Firefox
import {
  html,
  classMap,
  choose,
  when,
} from "chrome://global/content/vendor/lit.all.mjs";
// Rewrite to this
import { html } from "lit";
import { classMap } from 'lit/directives/class-map.js';
import { choose } from 'lit/directives/choose.js';
import { when } from 'lit/directives/when.js';
You need to log in before you can comment on or make changes to this bug.