
Discover five practical ways to scale knowledge sharing across engineering teams and reduce onboarding time, bottlenecks, and lost context.

Discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the March 4th issue.

Paige, Jack, Paul, and Noel dig into the biggest shifts reshaping web development right now, from OpenClaw’s foundation move to AI-powered browsers and the growing mental load of agent-driven workflows.

Check out alternatives to the Headless UI library to find unstyled components to optimize your website’s performance without compromising your design.
Hey there, want to help make our blog better?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
3 Replies to "How to detect dead code in a frontend project"
Great article! 👍
Regarding this part 👇
> The plugin will report unused files and unused exports into your terminal but those are not part of your webpack build process, therefore, it will not fail your build
According to their docs, there is a way `failOnHint` to fail the build if the `webpack-deadcode-plugin` finds something.
> options.failOnHint (default: false)
> Deadcode does not interrupt the compilation by default. If you want to cancel the compilation, set it true, it throws a fatal error and stops the compilation.
https://github.com/MQuy/webpack-deadcode-plugin#optionsfailonhint-default-false
Great point, indeed 👍 Thanks for pointing it out – definitely good to keep this option in mind if you want to use `webpack-deadcode-plugin` in CI!
One small remark 🙂
You don’t need to install depcheck before `npx depcheck`. There are just two options: do `npm i -g depcheck` or `npx depcheck`