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: use shared packages in src-gen #15185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Mar 13, 2025

What it does

Src-gen is executed in the environment controlled by adopters. In the generated code dependencies are imported. If these dependencies are not located where webpack expects them, the adopter will experience build errors. This is not a common case, but it does happen in practice.

The generated code is made more robust by reusing the shared core dependencies where applicable. As it's common to declare '@theia/core' as a dependency within the adopter package, this more commonly results in a working build.

Contributed on behalf of STMicroelectronics

How to test

Make sure example applications continue working

Follow-ups

This PR only adjusts imports which are already exported by @theia/core. This already improves the issue in real world use cases in which these packages were the affected ones in build errors.

For a more complete solution we should:

  • Reexport all packages in @theia/core which are used in src-gen, or,
  • Instruct adopters that this issue can occur with more esoteric setups and advise on how to resolve that, for example by redeclaring the non-shared-dependencies in the adopter package or making sure that the affected dependencies are hoisted.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Contributed on behalf of STMicroelectronics

Review checklist

Reminder for reviewers

Src-gen is executed in the environment controlled by adopters. In the
generated code dependencies are imported. If these dependencies are not
located where webpack expects them, the adopter will experience build
errors. This is not a common case, but it does happen in practice.

The generated code is made more robust by reusing the shared core
dependencies where applicable. As it's common to declare '@theia/core'
as a dependency within the adopter package, this more commonly results
in a working build.

Resolves eclipse-theia#15173

Contributed on behalf of STMicroelectronics
@sdirix sdirix linked an issue Mar 13, 2025 that may be closed by this pull request
@sdirix sdirix requested a review from rschnekenbu March 13, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

Generated code should reuse shared packages
1 participant