{"id":22397,"library":"split-vendor-chunk-plugin","title":"split-vendor-chunk-plugin","description":"A Vite plugin that automatically splits vendor chunks (node_modules imports) into separate files for improved caching and parallel loading. Current stable version: 7.0.0. The plugin groups node_modules imports into vendor chunks based on package name, with scoped packages handled separately. It is a lightweight alternative to manual Rollup/Vite manualChunks configuration. Release cadence is irregular but maintained.","status":"active","version":"7.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","vite","rollup","chunk","split","vendor","splitVendorChunkPlugin"],"install":[{"cmd":"npm install split-vendor-chunk-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add split-vendor-chunk-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add split-vendor-chunk-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import is correct; ESM-only, no CommonJS export.","wrong":"const splitVendorChunkPlugin = require('split-vendor-chunk-plugin')","symbol":"splitVendorChunkPlugin","correct":"import splitVendorChunkPlugin from 'split-vendor-chunk-plugin'"},{"note":"Call the function to return a plugin instance; do not pass the function reference directly.","wrong":"plugins: [splitVendorChunkPlugin]","symbol":"splitVendorChunkPlugin","correct":"plugins: [splitVendorChunkPlugin()]"},{"note":"Only default export exists (v1-v7). Named export is a common mistake.","wrong":"import splitVendorChunkPlugin from 'split-vendor-chunk-plugin'","symbol":"splitVendorChunkPlugin","correct":"import { splitVendorChunkPlugin } from 'split-vendor-chunk-plugin'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite'\nimport splitVendorChunkPlugin from 'split-vendor-chunk-plugin'\n\nexport default defineConfig({\n  plugins: [\n    splitVendorChunkPlugin()\n  ]\n})","lang":"javascript","description":"Basic Vite configuration using split-vendor-chunk-plugin to automatically split vendor chunks."},"warnings":[{"fix":"Avoid setting manualChunks when using this plugin, or customize manually via manualChunks instead of using this plugin.","message":"The plugin does not respect Vite's `build.rollupOptions.output.manualChunks` – it applies its own chunk splitting which may conflict with user-defined manualChunks.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a custom chunk name function or replace '@' in filenames if deployment fails.","message":"Scoped packages produce chunk names with '@' in filename, which may cause issues on some file systems or deployment servers (e.g., IIS).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace with Vite's manualChunks: `build: { rollupOptions: { output: { manualChunks(id) { if (id.includes('node_modules')) return 'vendor' } } } }`","message":"Deprecated: This plugin is effectively a wrapper around Vite's built-in `build.rollupOptions.output.manualChunks`. Since Vite 4+, consider using manualChunks directly for better control.","severity":"deprecated","affected_versions":">=7.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use ESM import: `import splitVendorChunkPlugin from 'split-vendor-chunk-plugin'` and call it: `plugins: [splitVendorChunkPlugin()]`","cause":"Using require instead of import (CJS) or forgetting to call the plugin function (e.g., passing reference directly).","error":"TypeError: splitVendorChunkPlugin is not a function"},{"fix":"Include `splitVendorChunkPlugin()` only once.","cause":"Adding the plugin multiple times in the plugins array.","error":"The plugin 'vite:split-vendor-chunk' has already been added"},{"fix":"Disable source maps or configure clean chunk names: e.g., replace '@' with '_' in manualChunks.","cause":"Source map issue when chunk name contains characters like '@' or parentheses from scoped packages.","error":"Error: ENOENT: no such file or directory, open '.../dist/assets/vendor-xxxxx.js.map'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}