DEV Community

Jen C.
Jen C.

Posted on

Optimize Core Web Vitals - FCP and LCP: Remove not need dependencies

Optimize Core Web Vitals - FCP and LCP: Remove not need dependencies

Check if any dependencies use this package

For example, use yarn to check glob

yarn why glob
Enter fullscreen mode Exit fullscreen mode

Output

Image description

This package is already used by another package

For example, when seeing

info Has been hoisted to "glob"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "@next#eslint-plugin-next#glob"
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "208KB"
info Disk size with transitive dependencies: "300KB"
info Number of shared dependencies: 8
...
Enter fullscreen mode Exit fullscreen mode

The package is not used by other packages

For example, when seeing

=> Found "negotiator@0.6.2"
info Has been hoisted to "negotiator"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "48KB"
info Disk size with unique dependencies: "48KB"
info Disk size with transitive dependencies: "48KB"
info Number of shared dependencies: 0
Enter fullscreen mode Exit fullscreen mode

Run yarn list --pattern <pattern> to filter the dependency list by pattern flag.

yarn list --pattern negotiator
Enter fullscreen mode Exit fullscreen mode

We can then remove the unused packages.

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay