{"id":20671,"library":"vite-plugin-inspect","title":"Vite Plugin Inspect","description":"A Vite plugin for inspecting the intermediate state of Vite plugins, useful for debugging and authoring plugins. Current stable version is v11.3.3, supporting Vite ^6.0.0 || ^7.0.0-0. v12.0.0-beta.1 is available, requiring Vite v8.0.0+ and @vitejs/devtools. Key differentiators: provides a GUI to view transformed module code, plugin hooks, and module dependency graphs during dev and build. ESM-only since v11.0.0. Ships TypeScript types.","status":"active","version":"11.3.3","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/vite-plugin-inspect","tags":["javascript","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-inspect","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-inspect","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-inspect","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin hooks into Vite's plugin system.","package":"vite","optional":false},{"reason":"Required for v12.x (beta) to enable devtools integration.","package":"@vitejs/devtools","optional":true}],"imports":[{"note":"Default export; v11.0.0+ is ESM-only, so require() will fail.","wrong":"const Inspect = require('vite-plugin-inspect')","symbol":"Inspect","correct":"import Inspect from 'vite-plugin-inspect'"},{"note":"The package exports a default function, not a named export.","wrong":"import { Inspect } from 'vite-plugin-inspect'","symbol":"default","correct":"import Inspect from 'vite-plugin-inspect'"},{"note":"TypeScript users can import the Options type for configuration.","wrong":"","symbol":"type Options","correct":"import type { Options } from 'vite-plugin-inspect'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport Inspect from 'vite-plugin-inspect'\n\nexport default defineConfig({\n  devtools: true,\n  plugins: [\n    Inspect()\n  ],\n})","lang":"typescript","description":"Sets up vite-plugin-inspect with devtools enabled for debugging plugin transformations in dev mode."},"warnings":[{"fix":"Ensure your project uses ESM (type: 'module' in package.json or .mjs file extensions). If using CJS, stay on v10.x.","message":"v11.0.0 drops CJS support; package is now ESM-only.","severity":"breaking","affected_versions":">=11.0.0"},{"fix":"Install @vitejs/devtools as a dependency and add 'devtools: true' to Vite config. Upgrade Vite to v8+.","message":"v12.x (beta) migrates to @vitejs/devtools and requires Vite v8.0.0+.","severity":"breaking","affected_versions":">=12.0.0-beta.1"},{"fix":"If using CJS with v10.3.0, use `const Inspect = require('vite-plugin-inspect').default` to work around the export issue.","message":"v11.0.0 deprecated the CJS build; v10.x had incorrect default exports in CJS.","severity":"deprecated","affected_versions":">=10.3.0 <11.0.0"},{"fix":"Add `build: true` to the options object: `Inspect({ build: true })`","message":"The 'build' option must be explicitly set to true to inspect transformations during build mode.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add the `devtools` key to your Vite config object (not the plugin).","message":"For v12.x, the plugin configuration changed: you need to set `devtools: true` or `devtools: { build: { withApp: true } }` in Vite config, not just in the plugin options.","severity":"gotcha","affected_versions":">=12.0.0-beta.1"},{"fix":"Upgrade to v10.3.0+ if you need CJS, or migrate to ESM and use v11.x.","message":"v10.x and earlier used 'vite-plugin-inspect' with CJS; default export was not compatible with CJS require.","severity":"deprecated","affected_versions":"<10.3.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install -D vite-plugin-inspect` and ensure your project is ESM (set `type: 'module'` in package.json).","cause":"Package not installed or CJS/ESM mismatch (v11+ is ESM-only).","error":"Error: Cannot find module 'vite-plugin-inspect'"},{"fix":"Use `import Inspect from 'vite-plugin-inspect'` (ESM) or `const Inspect = require('vite-plugin-inspect').default` (CJS, v10.x only).","cause":"Using named import `{ Inspect }` instead of default import with CJS interop in v10.x.","error":"TypeError: (0 , vite_plugin_inspect_1.default) is not a function"},{"fix":"Verify import is `import Inspect from 'vite-plugin-inspect'` and the package is installed correctly.","cause":"Calling `Inspect()` before the default import resolves; often due to circular dependencies or incorrect import path.","error":"TypeError: Inspect is not a function"},{"fix":"Run `npm install -D @vitejs/devtools` and add `devtools: true` to Vite config.","cause":"v12.x requires @vitejs/devtools as a separate dependency.","error":"Error: Cannot find module '@vitejs/devtools'"},{"fix":"Add `build: true` to the plugin options: `Inspect({ build: true })`.","cause":"Inspect() called without `build: true` when running `vite build`.","error":"Warning: The 'build' option is not enabled. Build transformations will not be captured."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}