Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(manager): remove duplicate lit module #2334

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

daniellacosse
Copy link
Contributor

@daniellacosse daniellacosse commented Jan 16, 2025

current findings:

  1. tried all the stuff in https://lit.dev/docs/tools/development/, didn't work for getting rid of the multiple dependencies, but gave useful context.
  2. Then I had the idea to use npm's override feature instead - at first to force all our dependencies to use lit@3 and @lit/[email protected]. This didn't work as npm can't force versions upon dependencies that those dependencies don't accept:
Screenshot 2025-01-17 at 3 13 24 PM
  1. Then I tried using override to enforce [email protected] instead, as it seemed that was the version all our dependencies would accept:
Screenshot 2025-01-17 at 3 23 43 PM

As you can see, this successfully removed the multiple versions of lit warning from the tests!

  1. However, the app broke. The "new key" dialog freezes when you edit it, similar to how the rename dialog did before we used the mwc component as a workaround. This further lends credence to the idea that @material/web (the more modern md prefixed web components) don't play well with the older lit versions and that upgrading to 3 will ultimately fix this issue.

At this point, I think our only option is to use Webpack to force resolution of lit throughout our build (something I was trying to avoid):

const path = require('path');

module.exports = {
  // ... other webpack configurations
  resolve: {
    alias: {
      // This will make sure that any dependency that imports 'lit' or any of its sub-modules
      // will use the version you installed in step 1
      lit: path.resolve(__dirname, 'node_modules/lit'),
      'lit/*': path.resolve(__dirname, 'node_modules/lit/*'),
    },
  },
};

This is a little tricky given our monorepo structure, but doable.

Out of scope would be to switch back to yarn, as yarn 2+ has really precise controls for managing the dependencies of your dependencies.

Also, we should probably let the lit team (?) know about the overrides trick I discovered? That way they can update their documentation to be more helpful.

@daniellacosse daniellacosse force-pushed the daniellacosse/dedupe_lit branch from 2a00ad0 to 7fe1874 Compare January 17, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants