Registry / devops / webpack-split-by-path

webpack-split-by-path

JSON →
library2.0.0jsnpmunverified

Webpack plugin to split an entry bundle into multiple smaller bundles based on absolute file paths. v2.0.1 is the latest stable version, compatible with webpack 2. v1.0.0 supports webpack 1. This plugin was largely superseded by webpack's built-in splitChunks in webpack 4+. It is based on split-by-name-webpack-plugin but uses absolute paths instead of module names. Useful for vendor bundle extraction in legacy webpack 1/2 projects.

npm install webpack-split-by-path
INSTALL
IMPORT
SIG · WEBPACK-SPLIT-BY-P
W
webpack-split-by-path
devopsjavascriptv2.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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

SplitByPathPlugin
const SplitByPathPlugin = require('webpack-split-by-path');
import SplitByPathPlugin from 'webpack-split-by-path';
Plugin uses CommonJS exports; no ES module or TypeScript types exist.
SplitByPathPlugin
const { SplitByPathPlugin } = require('webpack-split-by-path');
const { SplitByPathPlugin } = require('webpack-split-by-path');
Named import works but default import is used in docs; both are the same object.

Shows a minimal webpack configuration using SplitByPathPlugin to separate node_modules into a vendor chunk and a components chunk from the app entry.

// Example webpack.config.js using webpack-split-by-path const path = require('path'); const SplitByPathPlugin = require('webpack-split-by-path'); module.exports = { context: __dirname, entry: { app: './app.js' }, output: { path: path.resolve(__dirname, 'dist'), filename: '[name]-[chunkhash].js', chunkFilename: '[name]-[chunkhash].js' }, plugins: [ new SplitByPathPlugin([ { name: 'vendor', path: path.resolve(__dirname, 'node_modules') }, { name: 'components', path: path.resolve(__dirname, 'src/components') } ], { manifest: 'app-entry' }) ] };
Debug
Known issues
deprecatedWebpack 4+ recommends using built-in splitChunks optimization instead of this plugin. This plugin is a maintenance-only adaptation for webpack 2.
fix
Use optimization.splitChunks in webpack.config.js instead.
affects: >=4.0.0
breakingThe plugin configuration uses absolute paths, which can break when moving the project to a different directory or CI environment.
fix
Use path.resolve with __dirname to define absolute paths relative to project root.
affects: *
gotchaThe 'ignore' option expects absolute paths, not relative. Relative paths will silently fail to ignore modules.
fix
Use path.join(__dirname, 'relative/path') for ignore paths.
affects: *
gotchaMultiple chunks can match the same module; only the first matching bucket is used. Order of buckets matters.
fix
Place more specific paths before broader paths in the chunks array.
affects: *
deprecatedPlugin is not actively maintained. Last release was 2.0.1 in 2017.
fix
Consider migrating to webpack 4+ splitChunks.
affects: >=2.0.0
Errors
Common errors & fixes
Module not found: Error: Cannot resolve module 'webpack-split-by-path'
Missing npm install or wrong package name.
fix
Run 'npm install webpack-split-by-path' and ensure it's in package.json dependencies.
TypeError: SplitByPathPlugin is not a constructor
Incorrect import: using named export instead of default export.
fix
Use 'const SplitByPathPlugin = require("webpack-split-by-path")' instead of destructuring.
Configuration file found but error: Cannot find module 'webpack-split-by-path'
Global webpack install not finding local plugin.
fix
Run webpack from the project directory with local installation, or use npx webpack.
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Plugin instantiation options are incorrect, such as wrong 'chunks' array structure.
fix
Ensure chunks are an array of { name: string, path: string } objects with absolute paths.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Plugin configuration option 'ignoreChunks' is misspelled or used incorrectly.
fix
Use 'ignoreChunks' as a string or array of chunk names to ignore.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
webpack-split-by-path — npm install webpack-split-by-path · libregistry