Skip to content

Import loop in @lit/localize #4655

@codingjoe

Description

@codingjoe

Which package(s) are affected?

Localize (@lit/localize)

Description

Hi there 👋,

Thanks for all the wonderful work! I noticed a little something:

lit-localize.js and init/*.js have an import loop.

There is already a comment to drop the lines:
https://github.com/lit/lit/blob/abf30b3e895ea5d833f6d9559612e2b1ba47580d/packages/localize/src/lit-localize.ts#L15C1-L22C37

However, the comment is only regarding the bundle size, not the import loop.

Reproduction

I noticed this while using a post-processors, that traverses imports. It's much too complicated to set up, but you can simply check the imports manual and verify the issue:
https://github.com/search?q=repo%3Alit%2Flit+import+%7B_installMsgImplementation%7D+from+%27..%2Flit-localize.js%27%3B&type=code

Workaround

I used esbuild to bundled it. Most bundlers will ignore the loop.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

latest

Browser/OS/Node environment

OS independent issue.

Potential solutions

  1. Remove the code, that's marked for deprecation (clean, but risky).
  2. Move the _installMsgImplementation into a separate file (safe).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions