Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

PROGRAP/split-by-path-webpack-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Split By Path Webpack Plugin

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

Credits

This plugin is based on 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

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\/)/
      }]
    })
  ]
};

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%