There are currently two mature @TC39 proposals for the low-level functionality that would make it possible to declare *any* file type as a dependency:

1. Import text (Stage 3 as of last week!): https://github.com/tc39/proposal-import-text
2. Import bytes (Stage 2.7): https://github.com/tc39/proposal-import-bytes

Perhaps we should push for these to get implemented *first* instead of ad hoc types for every possible type of dependency (CSS modules, HTML modules, etc), which doesn’t scale.

GitHub - tc39/proposal-import-text: A TC39 proposal for importing text

A TC39 proposal for importing text. Contribute to tc39/proposal-import-text development by creating an account on GitHub.

GitHub
@leaverou @TC39 But we want CSS as CSS and HTML as HTML, the way we get JSON as JSON, not at strings or bytes. Won’t we have to “ad hoc” type them down the road anyway making it just delayed further but not continuing to work towards them now?

@westbrook When designing any product/API/language a common tension is:
1. Cover all use cases at 80% (low-level primitive)
vs
2. Cover only the common cases at 100% (high-level primitive).

The right call depends on the specifics, including:
1. What % of use cases would 2 leave out?
2. How painful are those use cases now?

If the answers are "high" and "very", 1 tends to be the right call, and buys you time to do 2 well, because now it's about reducing friction, not making things *possible*.

@westbrook Of course, here CSS modules have already shipped in 2/3 so it's low-hanging fruit to support them. I'm not suggesting doing Import Text *instead*, unless we figure out time travel meanwhile.

But we should definitely focus on these primitives before asking for any other types IMO or this situation will keep repeating.

@leaverou Thanks for clarifying! 😅 Because, I like the idea of "getting everything so right", but I am glad that that doesn't (in this case) superceed getting CSS import attributes into #webkit 🤞

I also like text, especially with so much text prompting going around, and agree it'll be a good next stop towards normalizing the super powers that import attributes provide at large!