Skip to content
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

chore(ssr): replace ramda with moderndash, reduce global package size #771

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Olyno
Copy link

@Olyno Olyno commented Apr 19, 2024

What kind of change does this PR introduce?

The SSR package does not have a lot of dependencies, but one of them is taking the whole place. I tried multiple tools to compare the size, and it looks ramda is the one having this issue.

I did some search, and the lightest package i found (not deprecated) was moderndash, offering around -75% less in terms of size, while still having the same features.

Some requirements are needed tho:

  • Node version >= 16.5
  • Typescript (if used) => 4.8

What is the current behavior?

The package is too heavy for the code inside it.

What is the new behavior?

This change reduces the size of the package. Not sure of how many, but it should reduce the size of 50% at least.

Additional context

Bundlephobia

image

pkg-size.dev

image

Npmjs

image

@Olyno Olyno requested a review from a team as a code owner April 19, 2024 12:10
@hf
Copy link
Contributor

hf commented Apr 20, 2024

Actually this whole library is unnecessary only for merge. If you want you can remove it with a local implementation of merge.

@silentworks
Copy link
Contributor

I just want to add here that at the time of working on this only ramda had support for mergeRight, note this isn't just a normal shallow merge or normal deep merge. Please take a look at what ramda mergeRight does before removing it.

@Olyno
Copy link
Author

Olyno commented May 2, 2024

From what i'm reading

Create a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects, the value from the second object will be used.

From my understanding, it is the same thing than a simple a shallow or deep merge, as it combines both objects by replacing values, and returns a new object. Except if i'm wrong, the code i'm using should do the job 🤔

Please tell me your thought about it @silentworks

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.

None yet

3 participants