Skip to content

A Vite plugin for plugin authors to make inspecting the resolved config easier.

License

Notifications You must be signed in to change notification settings

CMeeg/vite-plugin-inspect-config

Repository files navigation

vite-plugin-inspect-config

A Vite plugin to write the resolved config to disk for easy inspection.

This plugin is intended to be used by plugin authors who wish to view config changes made by plugins for debugging purposes i.e. "did my plugin mutate the config how I intended it to"!

Getting started

Add the package as a dev dependency:

npm install -D @meeg/vite-plugin-inspect-config

Add the plugin to your Vite config:

import { inspectConfig } from "@meeg/vite-plugin-inspect-config"
import { defineConfig } from "vite"

export default defineConfig({
	plugins: [
		inspectConfig()
	]
})

Now when you run vite dev or vite build the resolved config will be written to .vite-config/vite.config.json.

You may want to add .vite-config/ to your .gitignore.

Usage

The inspectConfig() function accepts an InspectConfigPluginOptions object that can be used for configuration:

Key Description Default
cwd The current working directory of the Vite project. process.cwd()
outputDir The path to the directory where vite.config.json will be written. The path is relative to cwd. ".vite-config"