{"id":22871059,"url":"https://github.com/wishy-gift/html-include-chunks-webpack-plugin","last_synced_at":"2025-05-05T22:17:23.980Z","repository":{"id":143807769,"uuid":"254905358","full_name":"wishy-gift/html-include-chunks-webpack-plugin","owner":"wishy-gift","description":"Webpack plugin for non-SPA apps with multiple entries using HtmlWebpackPlugin","archived":false,"fork":false,"pushed_at":"2021-03-10T19:49:10.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T22:17:16.019Z","etag":null,"topics":["html-include-chunks-webpack-plugin","html-webpack-plugin","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"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/wishy-gift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-04-11T16:10:44.000Z","updated_at":"2022-02-15T12:27:04.000Z","dependencies_parsed_at":"2023-07-11T14:33:52.333Z","dependency_job_id":null,"html_url":"https://github.com/wishy-gift/html-include-chunks-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishy-gift%2Fhtml-include-chunks-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishy-gift%2Fhtml-include-chunks-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishy-gift%2Fhtml-include-chunks-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishy-gift%2Fhtml-include-chunks-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wishy-gift","download_url":"https://codeload.github.com/wishy-gift/html-include-chunks-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252584333,"owners_count":21771945,"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":["html-include-chunks-webpack-plugin","html-webpack-plugin","webpack","webpack-plugin"],"created_at":"2024-12-13T13:17:06.038Z","updated_at":"2025-05-05T22:17:23.974Z","avatar_url":"https://github.com/wishy-gift.png","language":"JavaScript","readme":"[![npm](https://img.shields.io/npm/v/@wishy-gift/html-include-chunks-webpack-plugin)](https://www.npmjs.com/package/@wishy-gift/html-include-chunks-webpack-plugin)\n[![npm](https://img.shields.io/npm/dw/@wishy-gift/html-include-chunks-webpack-plugin)](https://www.npmjs.com/package/@wishy-gift/html-include-chunks-webpack-plugin)\n\n# HTML Include Chunks Webpack Plugin\n\nA Webpack plugin for non-SPA apps with multiple entries using HtmlWebpackPlugin\n\n## Installation\n\n### Webpack 5\n\n    npm install @wishy-gift/html-include-chunks-webpack-plugin\n\nor\n\n    yarn add @wishy-gift/html-include-chunks-webpack-plugin\n\n### Webpack 4\n\n    npm install @wishy-gift/html-include-chunks-webpack-plugin@0\n\nor\n\n    yarn add @wishy-gift/html-include-chunks-webpack-plugin@0\n\n## Usage\n\nThis plugin needs to be included after [HtmlWebpackConfig](https://github.com/jantimon/html-webpack-plugin/), and will look for the `entryKey` option in every usage of `HtmlWebpackConfig` to find which chunks should be included, and include only the ones needed for a given `entryKey`.\n\n## Options\n\nTakes no options, but uses `webpackConfig.output.publicPath` and requires that `entryKey` in `HtmlWebpackConfig` is specified, as the `entryKey` is used to filter the chunks\n\n## Example\n\n```javascript\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlIncludeChunksWebpackPlugin = require('@wishy-gift/html-include-chunks-webpack-plugin');\n\n// Create a separate object for our `entry`, so that we can iterate over it more easily later\nconst entry = {\n\ta: ['./a'],\n\tb: ['./b'],\n\tc: ['./c', './d'],\n};\n\n// Create one `HtmlWebpackPlugin` per entry, so that each entry can get only the necessary chunks\nconst entryHtmlPlugins = Object.keys(entry).map(\n\t(entryKey) =\u003e\n\t\tnew HtmlWebpackPlugin({\n\t\t\tfilename: `${entryKey}.html`,\n\t\t\tentryKey, // \u003c- this is how we know which chunks to include\n\t\t})\n);\n\nmodule.exports = {\n\tentry,\n\tplugins: [\n\t\t...entryHtmlPlugins,\n\t\tnew HtmlIncludeChunksWebpackPlugin(), // \u003c- `HtmlIncludeChunksWebpackPlugin` must be included after the `HtmlWebpackPlugin`s\n\t],\n};\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwishy-gift%2Fhtml-include-chunks-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwishy-gift%2Fhtml-include-chunks-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwishy-gift%2Fhtml-include-chunks-webpack-plugin/lists"}