
Learn how React Router’s Middleware API fixes leaky redirects and redundant data fetching in protected routes.

A developer’s retrospective on creating an AI video transcription agent with Mastra, an open-source TypeScript framework for building AI agents.

Learn how TanStack DB transactions ensure data consistency on the frontend with atomic updates, rollbacks, and optimistic UI in a simple order manager app.

useEffect mistakesDiscover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the November 5th issue.
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`