Deduplicate dependencies
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 146
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Currently, some dependencies are either imported twice or bundled incorrectly, which unnecessarily increases the final bundle size, and could lead to bugs with global state.
In particular, I noticed this because working on some new components I was getting errors saying that the components were already defined when I tried to used them. We're building components using Lit, and the default @customElement decorator registers a custom element globally without conditionals. In contrast, the components we had been defining ourselves were defined like this:
if (!customElements.get(BUTTON_TAG_NAME)) {
customElements.define(BUTTON_TAG_NAME, Button)
}
At first glance, it seems like this is good, because it gets rid of the error. But what it's actually doing is silencing an issue that should be solved instead. If the code to register a component is running twice, that usually means that the code has ended up twice in the final bundle.
It's not straight forward to solve given the current architecture and bundling configuration, but some first steps towards solving this have been made in https://github.com/SolidOS/solid-ui/issues/780. However, this is an issue with the entire SolidOS stack, not just the solid-ui package. So I'm opening this issue to track the problem until it's solved.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the related work in SolidOS/solid-ui issue 780, then trace the bundling configuration across the SolidOS stack. Identify where dependencies or component registrations are included more than once; done means duplicate code is removed, components register without errors, and the final bundle no longer contains unnecessary copies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, frontend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100