Skip to content

🧶 Add tslib to dependencies#4314

Merged
josemigallas merged 1 commit into
masterfrom
fix_webpack-dev-server_bump
Jun 12, 2026
Merged

🧶 Add tslib to dependencies#4314
josemigallas merged 1 commit into
masterfrom
fix_webpack-dev-server_bump

Conversation

@josemigallas

@josemigallas josemigallas commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

#4303 broke the image because shared dependencies with patternfly.

✨ Why this happened: Even though webpack-dev-server seems unrelated to PatternFly, it shares the same dependency tree. When webpack-dev-server updated, it pulled in new versions of dependencies (like memfs) that required newer tslib. Yarn's hoisting algorithm created a split where different packages got different tslib versions, breaking webpack's module resolution.

UPDATE:
Adding a resolution will force all packages to used this version, packages that may depend on tslib@1. It's safer to simply add tslib as a dependency to ensure it is available for react-icons.

The reason exactly why tslib is not available after webpack-dev-server bump is unknown: Claude blames yarn's hoisting algorithm and its dependency resolver. 😕

@josemigallas josemigallas self-assigned this Jun 10, 2026
Comment thread yarn.lock Outdated
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

tslib@^2.1.0, tslib@^2.4.0, tslib@^2.8.1:
tslib@2.8.1, tslib@^1.8.1, tslib@^1.9.3, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.8.1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not convinced about v1.8.1 and v1.9.3 being coerced to v2. Maybe this manual edit would be enough?

Suggested change
tslib@2.8.1, tslib@^1.8.1, tslib@^1.9.3, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.8.1:
tslib@^2.1.0, tslib@^2.4.0, tslib@^2.8.1, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.3.0:

And:

  • remove the resolution
  • remove the bloc for 2.5.0
  • keep the block for the v1 versions.

Not sure if a future yarn install would split the block into two again, one for 2.8.1 and another for 2.5.0. WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why would this be an advantage? I'd expect the lock file to be mostly managed by yarn, not edited manually to avoid issues like this in the future. But it's good to know also the advantages if any of your proposal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because if we add the resolution, that will force all packages that depend on tslib@^1.8.1 and tslib@^1.9.3 to use 2.8.1, which is a different major. That could cause issues somewhere else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think manually editing then lock file is good idea.
According to ✨ tslib is backwards compatible and this should be safe (take it with a pinch of salt).
I can investigate further if we can avoid both options, I also didn't like forcing to use v2.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bob actually suggested an alternative approach - to put tslib as a direct dep. But so far fails to suggest and meaningful advantage to it. So I will approve but I will leave between you to figure out which of all approaches is best.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After a long talk with Claude I think this is the safest solution @akostadinov . The only issue I have is tslib could be misidentified as a rogue dependency and be removed. I added a justification in the commit message to prevent this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After a long chat it sounded morelike your original solution was better but As I said, you decide.

Comment thread yarn.lock
akostadinov
akostadinov previously approved these changes Jun 10, 2026
jlledom
jlledom previously approved these changes Jun 10, 2026
@patternfly/react-icons uses tslib at runtime but only declares it as a devDependency. It worked by accident via yarn hoisting from sibling packages until the webpack-dev-server bump in #4303 disrupted hoisting.
@josemigallas josemigallas dismissed stale reviews from jlledom and akostadinov via 387cef0 June 12, 2026 08:30
@josemigallas josemigallas force-pushed the fix_webpack-dev-server_bump branch from 7351f2e to 387cef0 Compare June 12, 2026 08:30
@josemigallas josemigallas changed the title 🧶 Add resolution for tslib 🧶 Add tslib to dependencies Jun 12, 2026
Comment thread package.json
"showdown": "2.1.0",
"swagger-client": "^3.36.1",
"swagger-ui": "5.27.1",
"tslib": "2.8.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe ^2.0.0? That's the exact dependency used by patternfly/react

porta/yarn.lock

Line 2353 in 387cef0

tslib "^2.0.0"

I assume that's the one ract-icons should declare as well, right?

It's resolved as 2.5.0, not 2.8.1, but I guess it would work.

Anyway approving.

@josemigallas josemigallas Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It works (on my machine) and it should be compatible according to semver. Since it's our dependency now I think it's in our best interest to use the latest version compatible.

Also, dependably will go crazy if we install an older version haha

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fine for me 👍

@josemigallas josemigallas merged commit 9507f2f into master Jun 12, 2026
22 of 26 checks passed
@josemigallas josemigallas deleted the fix_webpack-dev-server_bump branch June 12, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants