Vite Plugin Entry Shaking Debugger
raw JSON → 2.0.2 verified Mon Apr 27 auth: no javascript
Debugger for vite-plugin-entry-shaking, a Vite plugin that improves tree shaking for re-exported entry points. Version 2.0.2 requires vite >=5.1.0 and vite-plugin-entry-shaking >=0.5.2 (peer dependency). Release cadence follows the main plugin with patch releases. Key differentiator: provides detailed logging and analysis of entry shaking transformations, helping developers identify why certain exports aren't being tree-shaken. Ships TypeScript types. ESM-only.
Common errors
error Error: Cannot find module 'vite-plugin-entry-shaking-debugger' ↓
cause Package not installed or not properly resolved.
fix
Run 'npm install -D vite-plugin-entry-shaking-debugger' or check package.json dependencies.
error TypeError: plugin.debug is not a function ↓
cause Debugger import missing or incorrect version of vite-plugin-entry-shaking.
fix
Ensure you have imported 'vite-plugin-entry-shaking-debugger' and that you are using vite-plugin-entry-shaking@0.5+.
Warnings
gotcha Debugger must be imported as a side-effect import. If not imported, setting 'debug: true' on the main plugin does nothing. ↓
fix Add 'import "vite-plugin-entry-shaking-debugger"' to your vite config file.
deprecated v1.x debugger versions are deprecated and not compatible with vite-plugin-entry-shaking >=0.5.0. ↓
fix Upgrade to vite-plugin-entry-shaking-debugger@2 and ensure vite-plugin-entry-shaking@0.5+.
breaking Version 2.0.0 dropped support for vite-plugin-entry-shaking <0.5.0 and vite <5.1.0. ↓
fix Update peer dependencies: vite >=5.1.0, vite-plugin-entry-shaking >=0.5.0.
gotcha The debugger only works in development mode; production builds ignore the setting. ↓
fix Use VITE_NODE_ENV=development or run 'vite' (not 'vite build') to see debug output.
Install
npm install vite-plugin-entry-shaking-debugger yarn add vite-plugin-entry-shaking-debugger pnpm add vite-plugin-entry-shaking-debugger Imports
- EntryShakingPlugin wrong
const EntryShakingPlugin = require('vite-plugin-entry-shaking')correctimport { EntryShakingPlugin } from 'vite-plugin-entry-shaking' - vite-plugin-entry-shaking-debugger wrong
import { debugger } from 'vite-plugin-entry-shaking-debugger'correctimport 'vite-plugin-entry-shaking-debugger' - type: EntryShakingPluginOptions wrong
import { EntryShakingPluginOptions } from 'vite-plugin-entry-shaking-debugger'correctimport type { EntryShakingPluginOptions } from 'vite-plugin-entry-shaking'
Quickstart
// vite.config.ts
import { defineConfig } from 'vite';
import { EntryShakingPlugin } from 'vite-plugin-entry-shaking';
import 'vite-plugin-entry-shaking-debugger'; // enables debug mode
export default defineConfig({
plugins: [
EntryShakingPlugin({
targets: ['./src/entries/index.ts'],
debug: true, // verbose logging for tree shaking analysis
}),
],
});