# split-by-path-webpack-plugin

> Split a Webpack entry bundle into any number of arbitrarily defined smaller bundles

Latest version **1.0.0** (published 2017-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install split-by-path-webpack-plugin
pnpm add split-by-path-webpack-plugin
yarn add split-by-path-webpack-plugin
bun add split-by-path-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-01-20 |
| First published | 2016-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Fabian Pirklbauer, SoundCloud, Nick Fisher |
| Maintainers | fabiandev |
| Keywords | webpack, plugin, split |

## Links

- npm: https://www.npmjs.com/package/split-by-path-webpack-plugin
- Repository: https://github.com/fabiandev/split-by-path-webpack-plugin
- Issues: https://github.com/fabiandev/split-by-path-webpack-plugin/issues
- npm.io page: https://npm.io/package/split-by-path-webpack-plugin

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-01-20
- 0.1.3 — 2016-11-16
- 0.1.2 — 2016-06-16
- 0.1.1 — 2016-06-14
- 0.1.0 — 2016-06-14

## README

## Split By Path Webpack Plugin

This plugin will split your entry bundle into any number of arbitrarily defined smaller bundles.

> Note: For webpack v1.x use version 0.x of this package, 1.x for webpack v2.x

## Credits

This plugin is based on [split-by-name-webpack-plugin](https://github.com/soundcloud/split-by-name-webpack-plugin).

### How?

Configuration of the plugin is simple. You instantiate the plugin with a single option: `buckets` which should be an
array of objects, each containing the keys `name` and `regex`. Any modules which are in your entry chunk which match the
bucket's regex (first matching bucket is used), are then moved to a new chunk with the given name.

Creating a 'catch-all' bucket is not necessary: anything which doesn't match one of the defined buckets will be left in
the original chunk.

### Example

```js
var SplitByPathPlugin = require('split-by-path-webpack-plugin');
module.exports = {
  entry: {
    app: 'app.js'
  },
  output: {
    path: __dirname + '/dist',
    filename: "[name]-[chunkhash].js",
    chunkFilename: "[name]-[chunkhash].js"
  },
  plugins: [
    new SplitByPathPlugin({
      buckets: [{
        name: 'vendor',
        regex: /(node_modules\/|src\/vendor\/)/
      }]
    })
  ]
};
```

---
_Source: https://npm.io/package/split-by-path-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
