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

Clean dependencies #739

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

Conversation

RKatarine
Copy link

@RKatarine RKatarine commented Jan 2, 2022

This PR has been motivated by the issue

  • replace comsiconfig to lilconfig;
  • replace one large lodash with special lodash.x with a specific function;
  • remove @types/fs-extra
  • replace globby to fast-glob

@ai
Copy link
Collaborator

ai commented Jul 24, 2022

Very important PR. We have node_modules performance problems because of astroturf dependencies size.

import JSON5 from 'json5';
import { lilconfig } from 'lilconfig';
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the tradeoff for this. is lilconfig feature matched with cosmiconfig (given what we and users might depend on)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Feature match is the idea of lilconfig (but it has fewer dependencies and works faster). I moved from cosmiconfig to lilconfig in PostCSS Load Config and Size Limit without any problems.

@@ -1,7 +1,7 @@
import { NodePath } from '@babel/core';
import generate from '@babel/generator';
import * as t from '@babel/types';
import get from 'lodash/get';
import get from 'lodash.get';
Copy link
Contributor

Choose a reason for hiding this comment

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

I really dislike these little packages. they may be smaller but it usually balloons the dep tree and number of transitive dependencies significantly. What is the actual cost saves between all of them over installing lodash. TBH I don't understand this sort of optimization, even on slow networks installing 70kb of text is not expensive, in the context of "putting files on disk to do development", I would imagine (unscientifically) having more limited deps, thereby reducing the amount of network hops and logic required by bundlers to install would be faster overall.

Copy link
Collaborator

Choose a reason for hiding this comment

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

lodash is 1.3 MB vs 23 KB for lodash.get

For instance, I don't have lodash in subdependecies of my projects. Adding extra MB will slow down CI by a few seconds.

Copy link

@krutoo krutoo Mar 14, 2023

Choose a reason for hiding this comment

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

@RKatarine @jquense @ai can we replace lodash by native ECMAScript features?

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.

4 participants