How to find unused packages in the meteor application?

During project developing stage added different packages from atmospher. But while moving on some packages might not used due to got some other better packages. Is there any way to find out unused packages in entire application.

What about just using grep to search for the package? Let’s say you want to check if the package alanning:roles is still in any code:

$ grep -ri alanning:roles .

(make sure you’re in the project folder first!)

grep is fine and dandy, but I actually prefer The Silver Searcher. You could install that, and then just enter this at a shell prompt:

$ ag alanning:roles
1 Like

Hi Thank you for your reply.

I can find what packages installed by seeing /.meteor/packages file. By using grep command i can find same location, but I am expecting whether one package is utilized in the project or not. Actually during development downloaded some packages, due to betterment, or some security issues used some other packages instead of those. Now project reached 80% of completion, required to remove unused packages in the application which are installed to reduce memory and to avoid security threats.

You’d just have to look through your codebase and see if you’re using any of the variables exported from each package.

If you have a package you suspect you’re not using:

  1. Check to see which variables the package exports
  2. Do a global find for each of those variables
  3. If none of the variables appears in your project code, remove the package

There’s no magic for this (at least that I know of). You just have to check each package and each exported variable manually, one-by-one.

2 Likes