2022-04-26
1513
#typescript#webpack
Iva Kop
105646
Apr 26, 2022 â‹… 5 min read

How to detect dead code in a frontend project

Iva Kop I am a self-taught software developer passionate about frontend development and architecture.

Recent posts:

Comparing Hattip Vs Express Js For Modern Application Development

Comparing Hattip vs. Express.js for modern app development

Explore what Hattip is, how it works, its benefits and key features, and the differences between Hattip and Express.js.

Antonello Zanini
May 2, 2024 â‹… 8 min read
Using React Shepherd To Build A Site Tour

Using React Shepherd to build a site tour

React Shepherd stands out as a site tour library due to its elegant UI and out-of-the-box, easy-to-use React Context implementation.

Onuorah Bonaventure
May 1, 2024 â‹… 14 min read
A Guide To Cookies In Next Js

A guide to cookies in Next.js

Cookies are crucial to web development. This article will explore how to handle cookies in your Next.js applications.

Georgey V B
Apr 30, 2024 â‹… 10 min read
Handling Dates In JavaScript With Tempo

Handling dates in JavaScript with Tempo

Use the Tempo library to format dates and times in JavaScript while accounting for time zones, daylight saying time, and date internationalization.

Amazing Enyichi Agu
Apr 30, 2024 â‹… 8 min read
View all posts

3 Replies to "How to detect dead code in a frontend project"

  1. 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

  2. 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`

Leave a Reply