在公司中,我们大部分都是多人共同开发和长时间维护一个项目,但是有时候我们会发现有很多已经废弃的npm 包存在 package.json 中,我们想要删除,但是又不能盲目的删除?那么 depcheck 它来了。
如何使用呢
第一步
全局安装:
npm install depcheck -g
第二步
项目更目录下执行 depcheck (这里拿我们自己的项目来做的测试),执行之后,根据自己得到的结果人工删除即可
Unused dependencies
* @xkeshi/vue-qrcode
* any-promise
* backpack-core
* cookie-universal-nuxt
* tls
* to
* vue-loader
* vue-meta-info
Unused devDependencies
* @babel/cli
* @babel/preset-es2015
* @babel/preset-react
* @babel/preset-stage-0
* @babel/register
* @nuxtjs/sentry
* axios-mock-adapter
* babel-eslint
* babel-loader
* babel-plugin-component
* child_process
* css-loader
* element-theme
* element-theme-chalk
* es3-compatible-webpack-plugin
* es3ify-loader
* eslint-friendly-formatter
* eslint-loader
* eslint-plugin-html
* express
* fs
* http-proxy-middleware
* jsencrypt
* lang
* net
* node-sass
* post-loader
* qs
* sass-loader
* vue-style-loader
* webpack-cli
Missing dependencies
* vue-no-ssr: ./.nuxt/components/no-ssr.js
* unfetch: ./.nuxt/client.js
* consola: ./.nuxt/client.js
* nuxt_plugin_route_338f5eda: ./.nuxt/index.js
* nuxt_plugin_main_6a83762f: ./.nuxt/index.js
* nuxt_plugin_http_6a8178fe: ./.nuxt/index.js
* nuxt_plugin_qrcode_7ec40a18: ./.nuxt/index.js
* nuxt_plugin_aliyunosssdkmin_02f21098: ./.nuxt/index.js
* nuxt_plugin_aliyunuploadsdk131min_c379eff6: ./.nuxt/index.js
* vue-router: ./.nuxt/router.js
* node-fetch: ./.nuxt/server.js
* vuex: ./.nuxt/store.js
* ~: ./assets/more-editor/more-editor.js
* resize-observer-polyfill: ./component/util/resizeEvent.js
* co: ./pages/circle/component/dakaEditor/editor.vue