You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## What's the problem this PR addresses?
π Hello! I was randomly looking at the `@yarnpkg/cli` bundle, 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`.

<details><summary>Full bundle graph</summary>
<img
src="https://github.com/user-attachments/assets/99133d9b-5bbf-4390-84ab-b608ef301501"
/>
</details>
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
](https://github.com/chalk/chalk/releases/tag/v4.0.0) up from v `3.0.0`.
The diff for 3.0.0 to 4.0.0 is
[here](chalk/chalk@v3.0.0...v4.0.0). 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
](https://github.com/chalk/chalk/releases/tag/v5.0.0)- 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/shell` [uses
some bespoke colors
](https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/sources/index.ts#L815-L815).
I tried to bump ink, as they've made some improvements too - but it
seems they expect tools to bundle with an `esm` format - wheras yarn is
currently bundling as `iife`, so would require decent patching or
upstream changes ( I couldn't get either to work just yet).
## How did you fix it?
`yarn upgrade-interactive` to 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
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
- [x] I have set the packages that need to be released for my changes to
be effective.
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
0 commit comments