-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register lodash as dependency to externalize it #1844
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@jorrit Thanks for your contribution, in order to merge the PR, you will need to generate changeset. You can run |
My apologies for not following the guidelines. I'll update the PR after the weekend. |
e682c67
to
cdec2c5
Compare
🦋 Changeset detectedLatest commit: 1b5a2d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cdec2c5
to
d6997ec
Compare
@HichamELBS: the commit has been updated. I found a couple of additional improvements using the |
Without this change, the dist files include the entire lodash source and some Radix UI utilities. Also removes a dependency from @strapi/ui-primitives that wasn't used.
d6997ec
to
1b5a2d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
What does it do?
I noticed that the dist files of the design system package contain the entire lodash source.
See: https://www.npmjs.com/package/@strapi/design-system/v/2.0.0-rc.14?activeTab=code
The design-system package uses lodash directly in extendTheme.ts but doesn't list this as a dependency in package.json. lodash happens to be present because it is a sub-sub-subdependency:
By making it a direct dependency, vite will not bundle it in the dist files. Besides that, it is more correct to not rely on sub-dependencies.
Why is it needed?
When investigating the dist code of the strapi-plugin-navigation module I noticed that it contains the entire lodash code. I investigated this and it lead to the conclusion that it is actually the design-system package that provides this.
See VirtusLab-Open-Source/strapi-plugin-navigation#509
How to test it?
Build the design-system package before and after this change and observe the file size decrease.
It may be the case that there are more dependencies of the code that could be externalized