{"id":22098679,"url":"https://github.com/leizeng/webpack-code-splitted-starter","last_synced_at":"2025-03-24T01:34:17.921Z","repository":{"id":146596140,"uuid":"60403417","full_name":"LeiZeng/webpack-code-splitted-starter","owner":"LeiZeng","description":null,"archived":false,"fork":false,"pushed_at":"2016-06-04T09:45:29.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T07:46:57.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeiZeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-04T09:42:04.000Z","updated_at":"2016-06-04T09:42:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"3dabac00-36d1-45c5-b591-88e881909154","html_url":"https://github.com/LeiZeng/webpack-code-splitted-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeiZeng%2Fwebpack-code-splitted-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeiZeng%2Fwebpack-code-splitted-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeiZeng%2Fwebpack-code-splitted-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeiZeng%2Fwebpack-code-splitted-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeiZeng","download_url":"https://codeload.github.com/LeiZeng/webpack-code-splitted-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195450,"owners_count":20575886,"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":[],"created_at":"2024-12-01T04:22:13.475Z","updated_at":"2025-03-24T01:34:17.885Z","avatar_url":"https://github.com/LeiZeng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Quick start for webpack code splitting\n-------------------------------------\n\nRefference:\n[Official Sample](https://github.com/webpack/webpack/tree/v2.1.0-beta.8/examples/common-chunk-and-vendor-chunk)\n\n##Getting start\n`npm i \u0026\u0026 npm run build`\n\nCode dependencies structure:\n```\n  src/\n    pageA.js\n      vendor1\n      utilA\n      utilB\n    pageB.js\n      utilB\n      utilC\n    pageC.js\n      vendor2\n      utilA\n      utilC\n```\n\nCode bundles structure:\n```\n  dist/js/\n    vendor.js\n      webpack_vendor\n      vendor1\n      vendor2\n    common.js\n      utilA\n      utilB\n      utilC\n    pageA.js\n    pageB.js\n    pageC.js\n```\n\nwebpack configuration:\n```js\nvar path = require(\"path\");\nvar CommonsChunkPlugin = require(\"webpack/lib/optimize/CommonsChunkPlugin\");\n\nmodule.exports = {\n    entry: {\n        vendor: [\"./src/vendor1\", \"./src/vendor2\"],\n        pageA: \"./src/pageA\",\n        pageB: \"./src/pageB\",\n        pageC: \"./src/pageC\"\n        // older versions of webpack may require an empty entry point declaration here\n        // common: []\n    },\n    output: {\n        path: path.join(__dirname, \"dist/js\"),\n        filename: \"[name].js\"\n    },\n    plugins: [\n        new CommonsChunkPlugin({\n            // The order of this array matters\n            names: [\"common\", \"vendor\"],\n            minChunks: 2\n        })\n    ]\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleizeng%2Fwebpack-code-splitted-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleizeng%2Fwebpack-code-splitted-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleizeng%2Fwebpack-code-splitted-starter/lists"}