Last active
November 20, 2020 12:51
-
-
Save xjamundx/0ea9838d937d4f3684ea79e85b11540b to your computer and use it in GitHub Desktop.
Quickly identify files unused by webpack
This file contains 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
# ----------------------------------- # | |
webpack --display-modules | awk '{print $2}' | grep ^\.\/ > files-processed.txt; | |
cd public/js/; # assumes all your files are here | |
find . -name "*.js" | grep -v eslint | grep -v __ > ../../files-all.txt; # excludes __tests__ and .eslintrc files | |
cd ../..; | |
cat files-all.txt | xargs -I '{}' sh -c "grep -q '{}' files-processed.txt || echo '{}'"; | |
rm files-processed.txt files-all.txt; | |
# ----------------------------------- # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment