Skip to content

Feature: Robustly handle imports that use import attributes #229

@fbartho

Description

@fbartho

In the hypothetical merger scenario of something using with import-attributes, I think we’re arbitrarily picking one of the nodes to merge the other into (presumably the earliest node becomes the parent).

Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with

I’m not sure what we should do if import attributes are in play:

  1. Prevent the merge if they use attributes
  2. Abort the merge if they don’t have identical attributes. (Is attribute order significant? Recent JS ecosystem stuff has made key ordering in a dictionary significant sometimes)
  3. Abort the merge if they have incompatible attributes.
  4. Merge the attributes

I only know how to implement 1 & 2. No idea how to implement 3 & 4.

I’m kind of of the mindset of either doing nothing until somebody reports an issue (I have no idea who actually uses this feature, and how), or implementing one of 1 or 2.

Further question: Is it legal to merge something without attributes into an expression that has some attributes? — If that’s not legal, then we likely have a bug that will require more significant work in our algorithm.

This ticket is a placeholder ticket: if you have a use-case for it, please speak up, and help answer correctness questions for us! Ideally with an example of correct behavior!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions