Tooling for finding unused files within sites/*-site packages#1495
Tooling for finding unused files within sites/*-site packages#1495
sites/*-site packages#1495Conversation
|
Generic potential gotchas here (from Claude, not Claude Code)
We only publish the Additional GotchasDynamic imports and requires - The plugin relies on webpack's static analysis. If your code uses dynamic imports like Server-side code - If you have any Node.js server code, build scripts, or tooling scripts in your repo that aren't processed by webpack, those will be flagged as unused. The plugin only knows about files that webpack touches. Test files and fixtures - Even if you're excluding Configuration files - Files like Static assets referenced outside JS/CSS - Images, fonts, or other assets that are referenced directly in HTML templates or accessed via public URLs rather than imported through webpack. Entry points and HTML templates - Your actual HTML files, webpack config files, and any templates that bootstrap the applications won't be traced. Documentation and type definitions - README files, TypeScript CI/CD and deployment scripts - Anything used in your build pipeline that isn't part of the webpack bundle. Future/staged code - Code behind feature flags that isn't currently imported in any active code path may appear unused. Your multi-flavor approach is smart, but I'd recommend also maintaining an allowlist of known "legitimately unused" patterns and doing a careful manual review before any bulk deletions! |
I was originally trying to find a way to find unused library code (e.g. within
packages/libs/*) so we could have a clean-out, but this wasn't quite up to that task.It will still be useful though. There are a bunch of unused files in
packages/sites/*-sitethat we could probably delete. Not today though.Anything not bundled by
webpackis listed by the new taskFor the original task,
knipmay be what we need.