Skip to content

Conversation

@florianduros
Copy link
Member

@florianduros florianduros commented Oct 20, 2025

Regression due to #31034
If shared components dependencies are installed locally, two instance of counterparts are used (one by EW and one by shared components)

@florianduros florianduros changed the title Fix translation Fix translation in dev mode Oct 20, 2025
@florianduros florianduros marked this pull request as ready for review October 20, 2025 14:17
@florianduros florianduros requested a review from a team as a code owner October 20, 2025 14:17
@florianduros florianduros requested review from dbkr and t3chguy October 20, 2025 14:17
globals: {
"react": "react",
"react-dom": "ReactDom",
"counterpart": "counterpart",
Copy link
Member

@t3chguy t3chguy Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is right

counterpart isn't an identifier in the global context?

Image

whereas react is

Image

So how is this meant to get loaded/passed to shared components?

Copy link
Member Author

@florianduros florianduros Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test it, I put counterpart as a dev dependencies of a EW module using this build of shared components. I was able to load the load counterpart in the shared components in the storybook of this module

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't what externals/globals does though, that's just node traversing up directories and picking up ../node_modules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So putting into a peer deps is enough?

Copy link
Member

@t3chguy t3chguy Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of where we want to use it both built and bypassing its build system like EW does, I'd imagine both should depend on it for real, then element-web's webpack just ensures there is only one copy of counterpart in its build using a resolve alias

That way all 3 permutations work:

  • Install ew deps only
  • Install sc deps only
  • Install deps in both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I made EW to resolve counterpart to the one in its node modules.

@florianduros florianduros added this pull request to the merge queue Oct 21, 2025
Merged via the queue into develop with commit 77c41d6 Oct 21, 2025
37 checks passed
@florianduros florianduros deleted the florianduros/counterpart-shared-component branch October 21, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants