Removing Unused Dependencies with grunt-amdcheck

I’ve recently been playing with the grunt-amdcheck plugin to remove unused dependencies from AMD modules. It’s common for define statements in an AMD project to accumulate unused dependencies over time as developers refactor, and it’s a good idea to clean those up from time to time as unused dependencies can:

  • Make it harder to maintain your code
  • Cause the browser to make unnecessary asynchronous requests at run time
  • Increase file size and download times

I worked with Mehdi Shojaei, the plugin’s author, on a couple of pull requests to make the plugin work better for my workflow. Namely I suggested that the plugin try to preserve the whitespace between arguments in define paths and module lists, and that it include an option to not overwrite files and that did not have unused dependencies.

Continue reading “Removing Unused Dependencies with grunt-amdcheck”