The Coverage tab in Chrome DevTools can give you a line-by-line breakdown of unused code.
Coverage class in Puppeteer can help you automate the process of detecting unused code and extracting used code.
Build tool for support for removing unused code #
Check out the following Tooling.Report tests to find out if your bundler supports features that make it easier to avoid or remove unused code:
Stack-specific guidance #
If you are using Angular CLI, include source maps in your production build to inspect your bundles.
- Source code for the Remove unused code audit
- Remove unused code
- Code Splitting
- Dead Code Elimination
- Dead Imported Code