ProductPromotion
Logo

Node.JS

made by https://0x3d.site

GitHub - siddharthkp/cost-of-modules: Find out which of your dependencies are slowing you down 🐢
Find out which of your dependencies are slowing you down 🐢 - siddharthkp/cost-of-modules
Visit Site

GitHub - siddharthkp/cost-of-modules: Find out which of your dependencies are slowing you down 🐢

GitHub - siddharthkp/cost-of-modules: Find out which of your dependencies are slowing you down 🐢

Cost of modules

Find out which of your dependencies is slowing you down

 

Build
Status npm npm

 

Sponsor

Sponsor

 

Find out which of your dependencies is causing bloat

Install

npm install -g cost-of-modules

Usage

Run cost-of-modules in the directory you are working in.

Options

--less Show the biggest 10 modules

--yarn Use yarn instead of npm to install dependencies

--no-install Skip installation

--include-dev Include devDependencies as well - for 🚀 collaborator experience

Show your support

:star: this repo

Motivation

I recently published a npm module (auto-install) and I wanted to know how many bytes am I making people download before they can use it. Turns out, it was a whopping 30M!

More than space on disk, I want to optimise for install speed - setup is part of the user experience

--

Now, there are 3 things that you can do to make your npm package smaller

  1. Make sure all your workflow tools are in devDependencies and not in dependencies These include your build tools, testing frameworks, etc. Only dependencies get installed when someone installs your package. (That being said, for better collaborator experience, you should optimise for both)

  2. Only include the files you need by using files in your package.json or by including a .npmignore. More on that here.

  3. Use packages which do the job and take the least amount of space. For example, I realised that I did not need yargs, I only needed their parser yargs-parser which is much smaller.

  4. Bonus: Bundle all your code together and strip out the functions that you don't use - I still have to try this out. This could be the most impactful one.

--

In my case, the big size was because of # 3, the bunch of npm packages that I was using.

You can't fix what you can't measure

With npm 2.x, it was easy to find how much space is each of your dependencies taking. You could just look at the size of each directory in node_modules

With npm 3, the packages are installed in flat manner, so it isn't so straightforward.

That's the reason why I created this tool.

--

Future

I would want to make this tool a pre-publish checklist.

  • See the size of your node_modules
  • Include the size of your files
  • Check if files or .npmignore exists
  • Check if there are any dev dependencies that are specified as dependencies (tricky)
  • Compare size with the last release. Something like this: Warning

License

MIT © siddharthkp

Articles
to learn more about the nodejs concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about NodeJS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory