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

Netlify-cli is very bloated #4556

Closed
1 task
RDIL opened this issue Apr 20, 2022 · 4 comments
Closed
1 task

Netlify-cli is very bloated #4556

RDIL opened this issue Apr 20, 2022 · 4 comments
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@RDIL
Copy link

RDIL commented Apr 20, 2022

Which problem is this feature request solving?

Netlify CLI is very, very big. It consumes roughly 194 megabytes of disk space when installed. This is easily one of, if not the biggest dependencies that a project can have. It would really benefit it to be smaller (faster install times, faster runtime environment, etc). Docusaurus removed it because of that: facebook/docusaurus#7216

This is a graph of all the dependencies present from a single install of netlify-cli:
Screen Shot 2022-04-20 at 10 38 34

Describe the solution you'd like

Ideas:

  • Bundle all the code, and run it through a minifier first, removing all dependencies from the package (when installed by consumers) - also use source maps to keep stack traces and such in-tact
  • Evaluate the dependency chain thoroughly to use smaller and less bloated packages

Pull request (optional)

  • I can submit a pull request.
@RDIL RDIL added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Apr 20, 2022
@Josh-Cena
Copy link

Josh-Cena commented Apr 20, 2022

Correction: 333MB of node_modules on its own, just that it uses some popular modules like express, lodash, and rxjs that luckily manage to be reused in Docusaurus' monorepo.

I really don't understand why it pulls in so much stuff just to run a dev server locally.

@Josh-Cena
Copy link

There are some low-hanging fruits to pruning dependency size. For example, netlify-cli depends on inquirer which pulls in rxjs. Switching to prompts will save 23MB on its own. See facebook/docusaurus#4012 and facebook/create-react-app#10083 for examples.

Pulling in both esbuild and babel also seems fishy to me, not to mention transitively pulling in [email protected] through precinct. I don't know exactly what features netlify-cli offers, but if it doesn't actually use the features of the typescript compiler, I strongly suggest considering forking that dependency.

It also pulls in a lot of type dependencies which can be refactored out to a separate package.

@kaelig
Copy link
Contributor

kaelig commented Mar 24, 2023

Following up – I just ran yarn why netlify-cli on the Netlify dashboard's repo.

It returned 273.17MB:

[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "netlify-cli"
info This module exists because it's specified in "devDependencies".
info Disk size without dependencies: "8.75MB"
info Disk size with unique dependencies: "77.49MB"
info Disk size with transitive dependencies: "273.17MB"
info Number of shared dependencies: 467

@sarahetter
Copy link
Contributor

Closing in favour of #3941 which has detailed plans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

4 participants