Registry / devops / vite-plugin-incremental-build

vite-plugin-incremental-build

JSON →
library2.0.0jsnpmunverified

A Vite plugin and wrapper that enables incremental builds for projects that need to build to disk instead of using the Vite dev server. Version 2.0.0 (stable) provides a patching mechanism for Vite config and supports build hooks. Unlike rollup-plugin-incremental, this is Vite-specific and tested mainly with Vue (React should work). Release cadence is low; the package ships TypeScript types.

npm install vite-plugin-incremental-build
INSTALL
IMPORT
SIG · VITE-PLUGIN-INCREM
V
vite-plugin-incremental-build
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

viteIncrementalBuild
import { viteIncrementalBuild } from 'vite-plugin-incremental-build'
const viteIncrementalBuild = require('vite-plugin-incremental-build')
ESM-only; require() will fail.
patchConfig
import { patchConfig } from 'vite-plugin-incremental-build'
import patchConfig from 'vite-plugin-incremental-build'
patchConfig is a named export, not the default.
default export
import viteIncrementalBuild from 'vite-plugin-incremental-build'
import { default } from 'vite-plugin-incremental-build'
The package also has a default export which is the same as viteIncrementalBuild for convenience.

Shows how to create an incremental build script using viteIncrementalBuild and patchConfig with a typical Vite config.

import { defineConfig } from 'vite'; import { viteIncrementalBuild, patchConfig } from 'vite-plugin-incremental-build'; const viteConfig = defineConfig({ plugins: [], root: './src', publicDir: 'public', build: { outDir: '../dist', emptyOutDir: true, }, }); viteIncrementalBuild({ config: patchConfig(viteConfig, { ignoreWarnings: false }), bundleName: 'bundle', watcherIgnoredFiles: ['./src/not-watched', /(^|[\/\\])\.\./], beforeBuildCallback: () => { console.log('Building...'); }, });
Debug
Known issues
gotchaThe project structure must match the expected layout with tools/incrementalBuild.ts and specific directory structure.
fix
Ensure your project follows the structure shown in the README.
affects: >=1.0.0
gotchaTested only for Vue; React is untested but should work.
fix
If using React, test thoroughly before relying on the plugin.
affects: >=1.0.0
gotchaBuild speed depends on the number of imported files by the saved file.
fix
Optimize imports to improve incremental build performance.
affects: >=1.0.0
gotchaUse the Vite dev server with CSP when possible instead of this plugin.
fix
For extensions, serve JS from localhost via Vite dev server.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module
Using CommonJS require() instead of ESM import.
fix
Use import { viteIncrementalBuild } from 'vite-plugin-incremental-build';
patchConfig is not a function
Importing patchConfig as default instead of named export.
fix
Use import { patchConfig } from 'vite-plugin-incremental-build';
Cannot find module 'tsx'
tsx is required to run the build script but not installed.
fix
Run npm i -D tsx
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
tsxrequiredRequired to run the incremental build script via tsx
Agent activity
2 hits · last 30 days
node
2
Resources
vite-plugin-incremental-build — npm install vite-plugin-incremental-build · libregistry