Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 953 Bytes

File metadata and controls

47 lines (36 loc) · 953 Bytes

DeadcodePlugin for Webpack

About

Plugin finds dead code in your project trying compare modules used at Webpack bundle with file system.

Setup demo

Install dependencies

npm istall

Build demo app from ./src/*

npm run build

See generated unused.json - it will contain potential dead code from your project

Add and configure plugin

Add into your webpack.config.ts DeadcodePlugin and pass config options:

const config: webpack.Configuration = {
    ...
    plugins: [
        new DeadcodePlugin(options),
    ],
    ...
}

options is an object of type PluginOptions:

type PluginOptions = {
    outputFile: string, // 'unused.json' by default
    rootDir: string // 'src' by default
}

See