Skip to content

Help adopters: Fail the build if duplicated Theia extensions are detected #15660

@sdirix

Description

@sdirix

Background:

Theia builds which include the same extension multiple times are almost always invalid. Including multiples times means that the extension is resolved to different locations, e.g. it is included in different versions or even in same version but in different locations.

This scenario can easily happen with complex application structures and either misconfigured version ranges or as a byproduct of npm package resolving (for example via yarn v1).

Theia src-gen is structured in a way that only one of the variants is included. This usually leads to a successful build, however starting the Theia based application then leads to a crash most of the time. Depending on how adopters construct their symbols, they might even end up in hard to diagnose runtime issues instead.

Feature Description:

The theia build command should check for this scenario and fail the build if it is detected, describing the found issue. As an escape hatch we should offer a --force flag to still continue, even if we detect this error.

The Theia CLI already offers this kind of check: theia check:theia-extensions. However there are two issues with it:

  • In the current state it does not work for all setups, as it expects a certain kind of package.json structure
  • It is difficult to discover and therefore mostly unused

We should either run theia check:theia-extensions as part of theia build or adapt theia build to implement the check there. Once this is completed, we can likely just remove the theia check:theia-extensions command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions