
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
webpack-split-by-path
Advanced tools
Split a Webpack entry bundle into any number of arbitrarily defined smaller bundles
This plugin will split a Webpack entry bundle into any number of arbitrarily defined smaller bundles.
Based on Split by Name Webpack Plugin.
Unlike original component, it uses absolute path to identify bundle.
Configuration of the plugin is simple. You instantiate the plugin with an array of objects, each containing the keys name
and path
. Any modules which are in your entry chunk which match the bucket's path (first matching bucket is used), are then moved to a new chunk with the given name.
path
should be an absolute path string value. It can be also an array of such values.
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.
Now, by separating the manifest info into a standalone chunk, vendor chunks(something like that) will stay the same with or without hashing unless you change their version.
new SplitByPathPlugin(chunks, options);
new SplitByPathPlugin([
{ name: 'c1', path: 'src/c1' },
{ name: 'vendor', path: path.join(__dirname, 'node_modules/')},
...chunkN
], {
ignore: [
'path/to/ingore/file/or/dir1',
'path/to/ingore/file/or/dir2'
]
});
var SplitByPathPlugin = require('webpack-split-by-path');
module.exports = {
entry: {
app: 'app.js'
},
output: {
path: __dirname + '/public',
filename: "[name]-[chunkhash].js",
chunkFilename: "[name]-[chunkhash].js"
},
plugins: [
new SplitByPathPlugin([
{
name: 'vendor',
path: path.join(__dirname, 'node_modules')
}
], {
manifest: 'app-entry'
})
]
};
So every module that is being requested from node_modules
will be placed in public/vendor.js
and everything else will be placed in public/app.js
.
FAQs
Split a Webpack entry bundle into any number of arbitrarily defined smaller bundles
We found that webpack-split-by-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.