Use Vite aliases to allow excluding commercial components
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript, vite
- Domain
- build-system, frontend
Research direction
Start by tracing the direct component imports in index.js and the generated Vite configuration in vite.generated.ts, then inspect package.json and the publishing setup. The work is done when applications can omit commercial components and dependencies while the remaining imports resolve cleanly in Vite development and npm installation.
Written by the indexing model from the issue text.
Description
The current implement is directly referencing all Vaadin components in react-components, regardless of the license of the component. This is problematic for users that are for some reason (e.g. government policy) required to only have open source dependencies in their application (in other words, it's not acceptable to have commercial dependencies even if those are not used). It is not practical to exclude specific components because of the way index.js directly imports all components. Tree shaking during the production build leaves out unused modules but Vite in dev mode will still try to load all the modules.
One way of solving this would be to configure Vite to have an alias for any missing dependency to replace that import with a dummy placeholder that just informs the user that the dependency was missing. We could make Vaadin's default Vite configuration (vite.generated.ts) check for the existence of each commercial web component dependency and include a corresponding alias in the Vite configuration if it's not present.
In addition to this, we also need to make it practical to exclude those dependencies on the npm level. One potential way for this is to have those web components as optional peer dependencies instead of regular dependencies. There has been some reports about version conflict issues in combination with peer dependencies so one alternative might to have a regular dependency in our own code but remove it from package.json when publishing the module to npm. In either case, we also need to have a separate dependency that applications should have in their package.json to explicitly include the optional components along with logic that automatically includes this dependency when com.vaadin:vaadin is on the classpath while not including it if only com.vaadin:vaadin-core is present.
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 4
- Avg merge
- 52m
- Merged PRs (30d)
- 7
Contributor guide
No contributing guide indexed for this repository
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.
More from vaadin/react-components
-
bug Impact: Low Severity: Major
Difficulty 4/5 3-5 days Newbie friendliness 48/100
vaadin/react-components#398 · 1 comment ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
vaadin/react-components#338 · 1 reaction ·
-
hilla react
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
vaadin/react-components#337 · 8 comments ·
-
bug Impact: Low Severity: Major
Difficulty 3/5 1-2 days Newbie friendliness 50/100
vaadin/react-components#323 ·
-
bug Impact: Low Severity: Minor
Difficulty 3/5 1-2 days Newbie friendliness 45/100
vaadin/react-components#322 ·
All issues in vaadin/react-components
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·