{"id":20850,"library":"webpack-vendor-chunk-plugin","title":"Webpack Vendor Chunk Plugin","description":"A webpack plugin (v1.0.0) that removes the runtime bootstrapping code from vendor chunks when using webpack 1.x with CommonsChunkPlugin. It prevents the vendor bundle from re-executing the vendor modules on load, ensuring that the runtime only exists in the main bundle. This plugin is specific to webpack 1.x and is not needed for webpack 2+ where the runtime behavior was changed. It is a niche tool for legacy webpack configurations where splitting vendor bundles incorrectly included runtime code.","status":"deprecated","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","webpack","vendor","entry","chunk"],"install":[{"cmd":"npm install webpack-vendor-chunk-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-vendor-chunk-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-vendor-chunk-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: works only with webpack 1.x and the CommonsChunkPlugin.","package":"webpack","optional":false}],"imports":[{"note":"This package is CommonJS only and predates ES modules in Node.js.","wrong":"import VendorChunkPlugin from 'webpack-vendor-chunk-plugin';","symbol":"VendorChunkPlugin","correct":"var VendorChunkPlugin = require('webpack-vendor-chunk-plugin');"},{"note":"The constructor accepts either a string or an array of strings, but using a single string is typical.","wrong":"new VendorChunkPlugin(['vendor']);","symbol":"VendorChunkPlugin","correct":"new VendorChunkPlugin('vendor');"},{"note":"Must be used after CommonsChunkPlugin in the plugins array.","wrong":"plugins: [new VendorChunkPlugin('vendor')]","symbol":"VendorChunkPlugin","correct":"plugins: [new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'), new VendorChunkPlugin('vendor')]"}],"quickstart":{"code":"var webpack = require('webpack');\nvar VendorChunkPlugin = require('webpack-vendor-chunk-plugin');\nmodule.exports = {\n  entry: {\n    app: './app.js',\n    vendor: ['react', 'redux'],\n  },\n  output: {\n    path: __dirname + '/dist',\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),\n    new VendorChunkPlugin('vendor'),\n  ],\n};","lang":"javascript","description":"Configures webpack 1.x to extract vendor modules into a separate chunk and removes runtime code from that chunk using VendorChunkPlugin."},"warnings":[{"fix":"Upgrade to webpack 2+ and remove this plugin.","message":"This plugin is only compatible with webpack 1.x. Webpack 2 and later handle vendor chunk runtime correctly without this plugin.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure CommonsChunkPlugin is registered before VendorChunkPlugin.","message":"The plugin must be placed after CommonsChunkPlugin in the plugins array, otherwise it will not find the vendor chunk.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a single chunk name that matches the CommonsChunkPlugin's output chunk.","message":"Passing an array of chunk names is supported but can be misleading; the plugin only removes runtime from chunks that are already extracted by CommonsChunkPlugin.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure vendor modules do not rely on runtime execution order; move side-effectful code to the main bundle.","message":"In some configurations, removing runtime code may cause modules in the vendor chunk to not execute at all if they have side effects.","severity":"breaking","affected_versions":">=1.0.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 webpack-vendor-chunk-plugin --save-dev' and require with correct case: require('webpack-vendor-chunk-plugin')","cause":"Typo in require path or incorrect package installation.","error":"Cannot find module './VendorChunkPlugin'"},{"fix":"Use CommonJS require: var VendorChunkPlugin = require('webpack-vendor-chunk-plugin');","cause":"Importing the module incorrectly in an ES module environment.","error":"VendorChunkPlugin is not a constructor"},{"fix":"Add CommonsChunkPlugin with the same chunk name before VendorChunkPlugin.","cause":"CommonsChunkPlugin not configured or chunk name mismatch.","error":"Invalid chunk name 'vendor': chunk not found"},{"fix":"Place CommonsChunkPlugin before VendorChunkPlugin in the plugins array.","cause":"VendorChunkPlugin called before CommonsChunkPlugin has processed chunks (wrong order in plugins array).","error":"Cannot read property 'chunks' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}