{"id":27520,"library":"vite-plugin-incremental-build","title":"Vite Plugin Incremental Build","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/momentumdash/vite-plugin-incremental-build","tags":["javascript","vite","incremental","build","typescript"],"install":[{"cmd":"npm install vite-plugin-incremental-build","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-incremental-build","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-incremental-build","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to run the incremental build script via tsx","package":"tsx","optional":false}],"imports":[{"note":"ESM-only; require() will fail.","wrong":"const viteIncrementalBuild = require('vite-plugin-incremental-build')","symbol":"viteIncrementalBuild","correct":"import { viteIncrementalBuild } from 'vite-plugin-incremental-build'"},{"note":"patchConfig is a named export, not the default.","wrong":"import patchConfig from 'vite-plugin-incremental-build'","symbol":"patchConfig","correct":"import { patchConfig } from 'vite-plugin-incremental-build'"},{"note":"The package also has a default export which is the same as viteIncrementalBuild for convenience.","wrong":"import { default } from 'vite-plugin-incremental-build'","symbol":"default export","correct":"import viteIncrementalBuild from 'vite-plugin-incremental-build'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport { viteIncrementalBuild, patchConfig } from 'vite-plugin-incremental-build';\n\nconst viteConfig = defineConfig({\n  plugins: [],\n  root: './src',\n  publicDir: 'public',\n  build: {\n    outDir: '../dist',\n    emptyOutDir: true,\n  },\n});\n\nviteIncrementalBuild({\n  config: patchConfig(viteConfig, { ignoreWarnings: false }),\n  bundleName: 'bundle',\n  watcherIgnoredFiles: ['./src/not-watched', /(^|[\\/\\\\])\\.\\./],\n  beforeBuildCallback: () => {\n    console.log('Building...');\n  },\n});","lang":"typescript","description":"Shows how to create an incremental build script using viteIncrementalBuild and patchConfig with a typical Vite config."},"warnings":[{"fix":"Ensure your project follows the structure shown in the README.","message":"The project structure must match the expected layout with tools/incrementalBuild.ts and specific directory structure.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If using React, test thoroughly before relying on the plugin.","message":"Tested only for Vue; React is untested but should work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Optimize imports to improve incremental build performance.","message":"Build speed depends on the number of imported files by the saved file.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For extensions, serve JS from localhost via Vite dev server.","message":"Use the Vite dev server with CSP when possible instead of this plugin.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import { viteIncrementalBuild } from 'vite-plugin-incremental-build';","cause":"Using CommonJS require() instead of ESM import.","error":"ERR_REQUIRE_ESM: require() of ES Module"},{"fix":"Use import { patchConfig } from 'vite-plugin-incremental-build';","cause":"Importing patchConfig as default instead of named export.","error":"patchConfig is not a function"},{"fix":"Run npm i -D tsx","cause":"tsx is required to run the build script but not installed.","error":"Cannot find module 'tsx'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}