【前端npm包推荐】 自动检测项目中未使用的代码

272 阅读1分钟

一个检测项目中未使用的npm包。

支持

  • 资源素材
  • 常量
  • TS类型声明(支持自动删除)

方便去除未使用素材,降低项目打包的大小。

毫秒级速度,项目零侵入,大小仅3KB。

安装

npm i -g file-check-used

用法

全局安装后在项目根目录中使用 fcu命令。

$ fcu

案例

$ fcu
? Enter the file path to be checkedDefaults to current path (.) 


? Enter the file path to be checkedDefaults to current path .
? Select the operation you want to check 
❯ constants 
  static file 
? Select the operation you want to check constants
📌 Check:  .js .jsx .ts .tsx
📌 Target:  .js .jsx .ts .tsx
📁 Count:  15
🚅 Start
✅ Done
================================
📁 src/components/layout/seoData.ts ⚙️  seoData
🔎 Unused constants:  1
🔎 A total of 1 unused variables were found. Please confirm whether the listed variables are used.
⏱️  : 299.249ms

License

MIT

NPM

file-check-used - npm (npmjs.com)