
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
vite-plugin-deadcodes
Advanced tools
Vite plugin to detect unused files. JS, TS, React, Vue projects are supported.
A vite plugin to detect unused files, which is similar to webpack-deadcode-plugin.
The detected result be like:
Javascript, typescript, react, vue projects are supported:
types only
(see below)@import
statements (see below)# npm
npm install vite-plugin-deadcodes --save-dev
# yarn
yarn add -D vite-plugin-deadcodes
# pnpm
pnpm add -D vite-plugin-deadcodes
// vite.config.js
import { defineConfig } from 'vite';
import vitePluginDeadcodes from 'vite-plugin-deadcodes';
export default defineConfig({
plugins: [
vitePluginDeadcodes(),
]
});
Or use with options:
// vite.config.js
import { defineConfig } from 'vite';
import vitePluginDeadcodes from 'vite-plugin-deadcodes';
export default defineConfig({
plugins: [
vitePluginDeadcodes({
src: '/path/to/src',
emit: '/path/to/result/deadcodes.json',
excludes: ['**/*.d.ts', '**/*.(stories|spec).(js|jsx)'],
}),
]
});
This plugin will only run in build mode.
npx vite build
interface Options {
src?: string;
emit?: boolean | string;
excludes?: string[];
console?: boolean;
}
path.join(process.cwd(), 'src')
)The source dir you want to detect.
path.join(process.cwd(), 'deadcodes.json')
)The path of the result file.
vitePluginDeadcodes({
emit: '/path/to/result/deadcodes.json'
})
[]
)The files that should be ignored.
vitePluginDeadcodes({
excludes: ['**/*.d.ts', '**/*.(stories|spec).(js|jsx)'],
})
false
)Set true
to show result in the console.
Typescript files that were composed of types only, these files will be removed by typescript parser. Example:
export type Foo = 'a' | 'b';
export interface Bar {
name: string;
}
If this file contains some exports that are not type, then it can be detected. Like:
export type Foo = 'a' | 'b';
export interface Bar {
name: string;
}
// This function will not be removed by ts parser
export const add = (a: number, b: number): number => a + b;
In the example below, styles/bar.less can not be detected, which is imported by @import statement.
Planing to fix it in the next version.
// foo.less
@import '../styles/bar.less'
.name {
color: blue;
}
// demo.js
import './foo.less'
FAQs
Vite plugin to detect unused files. JS, TS, React, Vue projects are supported.
The npm package vite-plugin-deadcodes receives a total of 0 weekly downloads. As such, vite-plugin-deadcodes popularity was classified as not popular.
We found that vite-plugin-deadcodes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.