feat(perf) - de-duplicate chalk dependency#6784
Merged
RDIL merged 4 commits intoyarnpkg:masterfrom May 16, 2025
Merged
Conversation
Contributor
Author
|
Ah, I left a type error in - will fix it when I'm back at my laptop! |
Member
|
Looks like the chalk type changed slightly, feel free to ping me once it's fixed |
Contributor
Author
|
@RDIL thanks for your patience, just fixed up those types ❤️ |
RDIL
approved these changes
May 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
👋 Hello! I was randomly looking at the
@yarnpkg/clibundle, and esbuild reported a few warnings (when building locally in the repo, and inspecting on https://esbuild.github.io/analyze/ ).One of these warnings, was that there are some duplicated external libraries - such as
chalk.Full bundle graph
The savings from this PR are tiny (a few kb), but worth doing :)
What does this PR do
This PR bumps chalk to consistently be v4.1.2 up from v
3.0.0.The diff for 3.0.0 to 4.0.0 is here. The only relevant breaking change is dropping node 8 support, which should suffice for yarn (current engines of yarn is set to 18).
Note
I didn't opt for v5 - as it's esm only, and may require some config tweaking. V5 is a smaller bundle though, ~half the size!
/aside - It would be a larger bundle saving to remove the dependency entirely to something like https://www.npmjs.com/package/picocolors - but that's potentially a larger piece of work, as
@yarnpkg/shelluses some bespoke colors .I tried to bump ink, as they've made some improvements too - but it seems they expect tools to bundle with an
esmformat - wheras yarn is currently bundling asiife, so would require decent patching or upstream changes ( I couldn't get either to work just yet).How did you fix it?
yarn upgrade-interactiveto specify v4 of chalk :)Note that yarn upgrade-interactive is difficult to use when using workspaces, until #3260 (or similar) are closed. Similarly reported in #2591 #3281.
Checklist