{"id":15491559,"url":"https://github.com/diegohaz/webpack-blocks-split-vendor","last_synced_at":"2025-04-22T19:21:43.307Z","repository":{"id":57397382,"uuid":"87020970","full_name":"diegohaz/webpack-blocks-split-vendor","owner":"diegohaz","description":"A webpack block that splits vendor javascript into separated bundle","archived":false,"fork":false,"pushed_at":"2018-03-07T16:40:14.000Z","size":187,"stargazers_count":15,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T17:43:05.950Z","etag":null,"topics":["bundle","vendor","webpack","webpack-blocks","webpack2"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diegohaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-02T22:44:02.000Z","updated_at":"2022-02-15T12:49:33.000Z","dependencies_parsed_at":"2022-09-15T17:13:22.678Z","dependency_job_id":null,"html_url":"https://github.com/diegohaz/webpack-blocks-split-vendor","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegohaz%2Fwebpack-blocks-split-vendor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegohaz%2Fwebpack-blocks-split-vendor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegohaz%2Fwebpack-blocks-split-vendor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegohaz%2Fwebpack-blocks-split-vendor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diegohaz","download_url":"https://codeload.github.com/diegohaz/webpack-blocks-split-vendor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249449610,"owners_count":21274333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","vendor","webpack","webpack-blocks","webpack2"],"created_at":"2024-10-02T07:54:15.059Z","updated_at":"2025-04-22T19:21:43.281Z","avatar_url":"https://github.com/diegohaz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-blocks-split-vendor\n\n[![Generated with nod](https://img.shields.io/badge/generator-nod-2196F3.svg?style=flat-square)](https://github.com/diegohaz/nod)\n[![NPM version](https://img.shields.io/npm/v/webpack-blocks-split-vendor.svg?style=flat-square)](https://npmjs.org/package/webpack-blocks-split-vendor)\n[![Build Status](https://img.shields.io/travis/diegohaz/webpack-blocks-split-vendor/master.svg?style=flat-square)](https://travis-ci.org/diegohaz/webpack-blocks-split-vendor) [![Coverage Status](https://img.shields.io/codecov/c/github/diegohaz/webpack-blocks-split-vendor/master.svg?style=flat-square)](https://codecov.io/gh/diegohaz/webpack-blocks-split-vendor/branch/master)\n\nA webpack block that splits vendor javascript into separated bundle.\n\n## Install\n\n    $ npm install --save webpack-blocks-split-vendor\n\n## Usage\n\n```js\nconst { createConfig, env } = require('webpack-blocks')\nconst splitVendor = require('webpack-blocks-split-vendor')\n\nmodule.exports = createConfig([\n  // creates a vendor.js file (or vendor.[chunkhash].js in production)\n  splitVendor(),\n\n  // creates a foo.js file\n  splitVendor('foo'), \n\n  // creates a foo.js file, but keeps offline-plugin/runtime out of vendor\n  splitVendor({ name: 'foo', exclude: /offline-plugin\\/runtime\\.js/ })\n\n  // creates a vendor.js file, but keeps lodash and offline-plugin/runtime out of vendor\n  splitVendor({ exclude: [/lodash/, /offline-plugin\\/runtime\\.js/] })\n])\n```\n\n## How it does\n\n-   changes the output filename to `[name].[chunkhash].js`;\n-   creates a bundle with `node_modules/**/*.js` files with the help of [`CommonsChunkPlugin`](https://webpack.js.org/plugins/commons-chunk-plugin/);\n-   uses [`webpack-md5-hash`](https://github.com/erm0l0v/webpack-md5-hash) instead of the standard webpack chunkhash so vendor bundle will have different hash from other bundles (otherwise, we would invalidate the vendor bundle cache everytime we update the app bundle, which would make this approach useless).\n\nFor more details, see [`src/index.js`](src/index.js).\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n-   [splitVendor](#splitvendor)\n-   [Condition](#condition)\n-   [Options](#options)\n\n### splitVendor\n\nReturns a webpack block that splits vendor javascript bundle.\n\n**Parameters**\n\n-   `options` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \\| [Options](#options))** \n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n### Condition\n\nType: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \\| [RegExp](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp) \\| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Condition](#condition)\u003e)\n\n### Options\n\nType: {name: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), test: [Condition](#condition)?, exclude: [Condition](#condition)?}\n\n**Properties**\n\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n-   `test` **[Condition](#condition)?** \n-   `exclude` **[Condition](#condition)?** \n\n## Other useful webpack blocks\n\n-   [`webpack-blocks-happypack`](https://github.com/diegohaz/webpack-blocks-happypack)\n-   [`webpack-blocks-server-source-map`](https://github.com/diegohaz/webpack-blocks-server-source-map)\n\n## License\n\nMIT © [Diego Haz](https://github.com/diegohaz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegohaz%2Fwebpack-blocks-split-vendor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegohaz%2Fwebpack-blocks-split-vendor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegohaz%2Fwebpack-blocks-split-vendor/lists"}