Registry / devops / webpack-vendor-chunk-plugin

webpack-vendor-chunk-plugin

JSON →
library1.0.0jsnpmunverified

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.

npm install webpack-vendor-chunk-plugin
INSTALL
IMPORT
SIG · WEBPACK-VENDOR-CHU
W
webpack-vendor-chunk-plugin
devopsjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

VendorChunkPlugin
var VendorChunkPlugin = require('webpack-vendor-chunk-plugin');
import VendorChunkPlugin from 'webpack-vendor-chunk-plugin';
This package is CommonJS only and predates ES modules in Node.js.
VendorChunkPlugin
new VendorChunkPlugin('vendor');
new VendorChunkPlugin(['vendor']);
The constructor accepts either a string or an array of strings, but using a single string is typical.
VendorChunkPlugin
plugins: [new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'), new VendorChunkPlugin('vendor')]
plugins: [new VendorChunkPlugin('vendor')]
Must be used after CommonsChunkPlugin in the plugins array.

Configures webpack 1.x to extract vendor modules into a separate chunk and removes runtime code from that chunk using VendorChunkPlugin.

var webpack = require('webpack'); var VendorChunkPlugin = require('webpack-vendor-chunk-plugin'); module.exports = { entry: { app: './app.js', vendor: ['react', 'redux'], }, output: { path: __dirname + '/dist', filename: 'bundle.js', }, plugins: [ new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'), new VendorChunkPlugin('vendor'), ], };
Debug
Known issues
deprecatedThis plugin is only compatible with webpack 1.x. Webpack 2 and later handle vendor chunk runtime correctly without this plugin.
fix
Upgrade to webpack 2+ and remove this plugin.
affects: >=1.0.0
gotchaThe plugin must be placed after CommonsChunkPlugin in the plugins array, otherwise it will not find the vendor chunk.
fix
Ensure CommonsChunkPlugin is registered before VendorChunkPlugin.
affects: >=1.0.0
gotchaPassing an array of chunk names is supported but can be misleading; the plugin only removes runtime from chunks that are already extracted by CommonsChunkPlugin.
fix
Use a single chunk name that matches the CommonsChunkPlugin's output chunk.
affects: >=1.0.0
breakingIn some configurations, removing runtime code may cause modules in the vendor chunk to not execute at all if they have side effects.
fix
Ensure vendor modules do not rely on runtime execution order; move side-effectful code to the main bundle.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module './VendorChunkPlugin'
Typo in require path or incorrect package installation.
fix
Run 'npm install webpack-vendor-chunk-plugin --save-dev' and require with correct case: require('webpack-vendor-chunk-plugin')
VendorChunkPlugin is not a constructor
Importing the module incorrectly in an ES module environment.
fix
Use CommonJS require: var VendorChunkPlugin = require('webpack-vendor-chunk-plugin');
Invalid chunk name 'vendor': chunk not found
CommonsChunkPlugin not configured or chunk name mismatch.
fix
Add CommonsChunkPlugin with the same chunk name before VendorChunkPlugin.
Cannot read property 'chunks' of undefined
VendorChunkPlugin called before CommonsChunkPlugin has processed chunks (wrong order in plugins array).
fix
Place CommonsChunkPlugin before VendorChunkPlugin in the plugins array.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
webpackrequiredPeer dependency: works only with webpack 1.x and the CommonsChunkPlugin.
Agent activity
4 hits · last 30 days
node
4
Resources
webpack-vendor-chunk-plugin — npm install webpack-vendor-chunk-plugin · libregistry