Created
January 31, 2022 02:11
-
-
Save carlovsk/8ba655431c720721212ad3b337ab8e36 to your computer and use it in GitHub Desktop.
List heavy deps from a given string - which is an output from the command `du -skh node_modules/*` on your project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listHeavyPackages = packages => packages.split(`\n`).forEach(packageRow => { | |
if (packageRow === ``) return | |
const [s, p] = packageRow.split(`\t`) | |
const size = s.trim() | |
const package = p.trim() | |
if (size.includes('M')) console.log(`${package} might be a heavy package: ${size}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet will show you the dependencies of your project that are heavier than 1M. For that, you'll need the list of all of your deps and their sizes. You can do it by:
Go to the file
deps.txt
and all of your deps will be there. Copy the content, paste on any JavaScript console inside a variable and call the function. Just like that:The output will look like this: