{"id":20833,"library":"webpack-split-by-path","title":"webpack-split-by-path","description":"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.","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/BohdanTkachenko/webpack-split-by-path","tags":["javascript","webpack","plugin"],"install":[{"cmd":"npm install webpack-split-by-path","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-split-by-path","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-split-by-path","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin uses CommonJS exports; no ES module or TypeScript types exist.","wrong":"import SplitByPathPlugin from 'webpack-split-by-path';","symbol":"SplitByPathPlugin","correct":"const SplitByPathPlugin = require('webpack-split-by-path');"},{"note":"Named import works but default import is used in docs; both are the same object.","wrong":"const { SplitByPathPlugin } = require('webpack-split-by-path');","symbol":"SplitByPathPlugin","correct":"const { SplitByPathPlugin } = require('webpack-split-by-path');"}],"quickstart":{"code":"// Example webpack.config.js using webpack-split-by-path\nconst path = require('path');\nconst SplitByPathPlugin = require('webpack-split-by-path');\n\nmodule.exports = {\n  context: __dirname,\n  entry: {\n    app: './app.js'\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name]-[chunkhash].js',\n    chunkFilename: '[name]-[chunkhash].js'\n  },\n  plugins: [\n    new SplitByPathPlugin([\n      {\n        name: 'vendor',\n        path: path.resolve(__dirname, 'node_modules')\n      },\n      {\n        name: 'components',\n        path: path.resolve(__dirname, 'src/components')\n      }\n    ], {\n      manifest: 'app-entry'\n    })\n  ]\n};","lang":"javascript","description":"Shows a minimal webpack configuration using SplitByPathPlugin to separate node_modules into a vendor chunk and a components chunk from the app entry."},"warnings":[{"fix":"Use optimization.splitChunks in webpack.config.js instead.","message":"Webpack 4+ recommends using built-in splitChunks optimization instead of this plugin. This plugin is a maintenance-only adaptation for webpack 2.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Use path.resolve with __dirname to define absolute paths relative to project root.","message":"The plugin configuration uses absolute paths, which can break when moving the project to a different directory or CI environment.","severity":"breaking","affected_versions":"*"},{"fix":"Use path.join(__dirname, 'relative/path') for ignore paths.","message":"The 'ignore' option expects absolute paths, not relative. Relative paths will silently fail to ignore modules.","severity":"gotcha","affected_versions":"*"},{"fix":"Place more specific paths before broader paths in the chunks array.","message":"Multiple chunks can match the same module; only the first matching bucket is used. Order of buckets matters.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider migrating to webpack 4+ splitChunks.","message":"Plugin is not actively maintained. Last release was 2.0.1 in 2017.","severity":"deprecated","affected_versions":">=2.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-split-by-path' and ensure it's in package.json dependencies.","cause":"Missing npm install or wrong package name.","error":"Module not found: Error: Cannot resolve module 'webpack-split-by-path'"},{"fix":"Use 'const SplitByPathPlugin = require(\"webpack-split-by-path\")' instead of destructuring.","cause":"Incorrect import: using named export instead of default export.","error":"TypeError: SplitByPathPlugin is not a constructor"},{"fix":"Run webpack from the project directory with local installation, or use npx webpack.","cause":"Global webpack install not finding local plugin.","error":"Configuration file found but error: Cannot find module 'webpack-split-by-path'"},{"fix":"Ensure chunks are an array of { name: string, path: string } objects with absolute paths.","cause":"Plugin instantiation options are incorrect, such as wrong 'chunks' array structure.","error":"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."},{"fix":"Use 'ignoreChunks' as a string or array of chunk names to ignore.","cause":"Plugin configuration option 'ignoreChunks' is misspelled or used incorrectly.","error":"WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}