0.1.1 • Published 9 years ago
split-by-name-webpack2-plugin v0.1.1
split-by-name-webpack2-plugin
soundcloud/split-by-name-webpack-plugin fork that works with webpack2. It allows you to split bundle into multiple chunks based on location of the modules. Node.js 6+.
Installation
npm install split-by-name-webpack2-plugin --save-devUsage
Given
node_modules/...
src/index.js(where
src/index.jsis referencing some of the modules innode_modules)
and webpack.config.js
var SplitByNamePlugin = require('split-by-name-webpack2-plugin')
module.exports = {
entry: {
index: 'src/index.js'
},
output: {
path: __dirname + '/build',
filename: "[name].js"
},
plugins: [
new SplitByNamePlugin({
buckets: [{
name: 'vendor',
regex: /\/node_modules\//
}]
})
]
}webpack (tested on webpack@2.1.0-beta.20) will produce
build/{vendor,index}.js(where
build/vendor.jscontainsrequire(...)dnode_modules/...)
Legal
Original copyright (c) 2014 SoundCloud, Nick Fisher (MIT).
This fork is licensed under the same MIT license.