vite-plugin-entry-shaking weekly downloads statistics
By Dschungelabenteuer (2 listings) · npm · Vite plugins
Mimic tree-shaking behaviour when importing code from an entry file in development mode.
vite-plugin-entry-shaking has 6,055 recorded weekly downloads on npm, a decrease of 4.3% over the past 30 days, ranking #1458 of 3,247 tracked listings.
About vite-plugin-entry-shaking
[!NOTE] The main execution logic of this plugin only applies to development mode because it addresses an issue which is specific to development mode. It may be used in test environments that rely on Vite (e.g. Vitest) but should be used with caution as stated in limitations.
Install
# Using npm
npm i -D vite vite-plugin-entry-shaking
# Using Yarn
yarn add -D vite vite-plugin-entry-shaking
# Using pnpm
pnpm add -D vite vite-plugin-entry-shaking
Usage
Setup the plugin in your Vite configuration file.
import { resolve } from 'path';
import { defineConfig } from 'vite';
import EntryShakingPlugin from 'vite-plugin-entry-shaking';
export default defineConfig({
plugins: [
EntryShakingPlugin({
targets: [
// Using direct paths.
resolve(__dirname, 'src/entry-a'),
// Or using glob patterns.
{
glob: 'src/utils/*.ts',
globOptions: { ignore: ['excluded.ts'] },
}
],
}),
],
});
Plugin options
<table> <thead> <tr> <th>Option name</th> <th>Type</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>targets <em>(required)</em></td> <td> <ul> <li><code>string[]</code></li> <li><code>{ path: string }[]</code></li> <li><code>{ glob: string; globOptions: import('fast-glob').Options }[]</code></li> </ul> </td> <td>N/A</td> <td>You need to list all of the entry points you want this plugin to process.</td> </tr> <tr> <td>extensions</td> <td><code>string[]</code></td> <td><code>['js', 'jsx', 'mjs', 'ts', 'tsx', 'mts']</code></td> <td>This specifies which file extensions you want this plugin to process.</td> </tr> <tr> <td>ignorePatterns</td> <td><code>(string | RegExp)[]</code></td> <td><code>[/node_modules/]</code></td> <td>This specifies RegExp/string whose matched paths must be ignored by the plugin.</td> </tr> <tr> <td>maxWildcardDepth</td> <td><code>number</code></td> <td><code>0</code></td> <td>How deep should this plugin run static analysis when encountering wildcards?</td> </tr> <tr> <td>diagnostics</td> <td><code>boolean | DiagnosticsConfig</code></td> <td><code>true</code></td> <td>Toggles all diagnostics when set as a boolean, or specific diagnostics when set as an object.</td> </tr> <tr> <td>debug</td> <td><code>boolean</code></td> <td><code>false</code></td> <td>Toggles debug mode. This will print debug logs if Vite's <code>logLevel</code> is set to any other value than <code>'silent'</code></td> </tr> </tbody> </table>Diagnostics configuration
Diagnostics are recommendations/warnings emitted by the plugin as it analyzes the specified entry files. They aim to help you improve the plugin's efficiency by suggesting changes and provide explanation on why they were emitted. See RESOURCES for a more in-depth insight about possible diagnostics.
<table> <thead> <tr> <th>Name</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>definedWithinEntry</td> <td><code>true</code></td> <td>Emit warning if an entry file defines code that may prevent tree-shaking.</td> </tr> <tr> <td>maxDepthReached</td> <td><code>true</code></td> <td>Emits a warning when max analysis depth was reached when handling wildcard imports.</td> </tr> </tbody> </table>Examples
Examples illustrating usage and benefits can be found here. Feel free to fork and play around. For instance, you can toggle the plugin on and off their respective vite config file while serving in development mode and see how it affects the amount of requests made by your browser.
This repository provides a simple CLI to help you quickly scaffold a new example, simply run the following command from the project's root to get started:
pnpm generate-example
Debugger (experimental)
Version 0.4.0 introduces
a debugger
as an optional dependency. When installed and attached to the plugin, a debugger application will
open alongside your actual application in dev mode. This can help you get an overall idea of what
the plugin is processing and its impacts on performances.
[!NOTE] This requires installing
vite-plugin-entry-shaking-debuggerand setting thedebugoption totrue.
Motivation…
Description from the npm listing.
- vite
- vite-plugin
- entry
- tree shaking
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Vite plugins plugins
All 20 vite-plugin-entry-shaking alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-entry-shaking. First seen Oct 16, 2026; last successful collection Dec 4, 2026. See the methodology.