{"id":16326545,"url":"https://github.com/icelam/html-inline-script-webpack-plugin","last_synced_at":"2025-08-16T17:04:41.402Z","repository":{"id":39261398,"uuid":"278281826","full_name":"icelam/html-inline-script-webpack-plugin","owner":"icelam","description":"A webpack plugin for converting external script files to inline script block. Requires 'html-webpack-plugin' to work.","archived":false,"fork":false,"pushed_at":"2024-08-01T10:30:34.000Z","size":1842,"stargazers_count":57,"open_issues_count":10,"forks_count":11,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-07-24T01:46:42.514Z","etag":null,"topics":["html-webpack-plugin","inline-script","inline-source","typescript","webpack","webpack-plugin","webpack4"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/html-inline-script-webpack-plugin","language":"TypeScript","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/icelam.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},"funding":{"github":["icelam"],"ko_fi":"icelam"}},"created_at":"2020-07-09T06:28:36.000Z","updated_at":"2025-04-28T06:20:26.000Z","dependencies_parsed_at":"2024-01-29T10:06:40.023Z","dependency_job_id":"98071be2-3254-497f-a60c-f15c6e2d8858","html_url":"https://github.com/icelam/html-inline-script-webpack-plugin","commit_stats":{"total_commits":195,"total_committers":3,"mean_commits":65.0,"dds":"0.28205128205128205","last_synced_commit":"d9e94ff60c8f09cf15e2f295a213794c4c7d7186"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/icelam/html-inline-script-webpack-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelam%2Fhtml-inline-script-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelam%2Fhtml-inline-script-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelam%2Fhtml-inline-script-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelam%2Fhtml-inline-script-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icelam","download_url":"https://codeload.github.com/icelam/html-inline-script-webpack-plugin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelam%2Fhtml-inline-script-webpack-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270742043,"owners_count":24637504,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-webpack-plugin","inline-script","inline-source","typescript","webpack","webpack-plugin","webpack4"],"created_at":"2024-10-10T23:08:41.552Z","updated_at":"2025-08-16T17:04:41.342Z","avatar_url":"https://github.com/icelam.png","language":"TypeScript","readme":"# HTML Inline Script Webpack Plugin for webpack (html-inline-script-webpack-plugin)\n\n[![Latest version](https://img.shields.io/github/v/release/icelam/html-inline-script-webpack-plugin.svg?sort=semver\u0026label=latest)](https://github.com/icelam/html-inline-script-webpack-plugin/releases)\n[![Download count](https://img.shields.io/npm/dm/html-inline-script-webpack-plugin)](https://www.npmjs.com/package/html-inline-script-webpack-plugin)\n[![Install size](https://packagephobia.com/badge?p=html-inline-script-webpack-plugin)](https://packagephobia.com/result?p=html-inline-script-webpack-plugin)\n![ci](https://github.com/icelam/html-inline-script-webpack-plugin/workflows/ci/badge.svg)\n[![Package quality](https://npm.packagequality.com/shield/html-inline-script-webpack-plugin.svg)](https://packagequality.com/#?package=html-inline-script-webpack-plugin)\n\n[![NPM](https://nodei.co/npm/html-inline-script-webpack-plugin.png?compact=true)](https://npmjs.org/package/html-inline-script-webpack-plugin)\n\nA webpack plugin for converting external script files `\u003cscript src=\"app.js\"\u003e\u003c/script\u003e` to inline script block `\u003cscript\u003e...\u003c/script\u003e`. Requires [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) to work.\n\nInspired by [react-dev-utils](https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/InlineChunkHtmlPlugin.js) created by [Facebook](https://github.com/facebook/).\n\n## Install\n\n### Webpack5\n\n```bash\nnpm i html-inline-script-webpack-plugin -D\n```\n\n### Webpack4\n\n```bash\nnpm i html-inline-script-webpack-plugin@^1 -D\n```\n\n## Usage\n\nBy default, the plugin will convert all the external script files to inline script block, and remove the original script file from build assets.\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');\n\nmodule.exports = {\n  plugins: [new HtmlWebpackPlugin(), new HtmlInlineScriptPlugin()],\n};\n```\n\n## Options\n\nBelow are lists of options supported by this plugin:\n\n| Name               | Description                                                                                                                                                                                                                                                                             | Type     |\n| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |\n| scriptMatchPattern | List of script files that should be processed and inject as inline script. This will be filtered using the output file name.                                                                                                                                                     | RegExp[] |\n| htmlMatchPattern   | List of HTML template files that should be processed by this plugin. Useful when you have multiple `html-webpack-plugin` initialized. This will be filtered using the [`options?.filename`](https://github.com/jantimon/html-webpack-plugin#options) provided by `html-webpack-plugin`. | RegExp[] |\n| assetPreservePattern  | List of script files that should be preserved by this plugin after inserting them inline. This will be filtered using the output file name. | RegExp[] |\n\nHere are some examples illustrating how to use these options:\n\n##### Process only script files that have file name start with `runtime~` and `app~`\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new HtmlWebpackPlugin(),\n    new HtmlInlineScriptPlugin({\n      scriptMatchPattern: [/runtime~.+[.]js$/, /app~.+[.]js$/],\n    }),\n  ],\n};\n```\n\n##### Process any script files but only have them inlined in `index.html`\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: 'index.html',\n      template: 'static/index.webos.html',\n    }),\n    new HtmlWebpackPlugin({\n      filename: 'page2.html',\n      template: 'page2.html',\n    }),\n    new HtmlInlineScriptPlugin({\n      htmlMatchPattern: [/index.html$/],\n    }),\n  ],\n};\n```\n\n##### Process script files that have file name start with `runtime~` and `app~` and inject only to `index.html`\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: 'index.html',\n      template: 'static/index.webos.html',\n    }),\n    new HtmlWebpackPlugin({\n      filename: 'page2.html',\n      template: 'page2.html',\n    }),\n    new HtmlInlineScriptPlugin({\n      scriptMatchPattern: [/runtime~.+[.]js$/, /app~.+[.]js$/],\n      htmlMatchPattern: [/index.html$/],\n    }),\n  ],\n};\n```\n##### Process any script files but preserve `main.js` from build assets\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new HtmlWebpackPlugin(),\n    new HtmlInlineScriptPlugin({\n      assetPreservePattern: [/main.js$/],\n    }),\n  ],\n};\n```\n\n## Known limitations\n1. This plugin does not transform Web Worker syntax like `new Worker(new URL('./worker.js', import.meta.url));``. It simply embeds the source code processed by webpack into HTML files, and emits any JavaScript files that is not processed by the plugin.\n2. This plugin is designed to embed script content into HTML files for deployment to environments where only a single file can be uploaded, or where the script file itself is small enough that it doesn't warrant an additional HTTP request. It is not intended for use in development, and may fail if HMR is enabled.\n3. This plugin does not support inlining scripts that are dynamically imported (the `import()` syntax). The reason is explained in [this issue](https://github.com/icelam/html-inline-script-webpack-plugin/issues/494#issuecomment-2016902280).\n\n## Contributors\n\nThanks goes to these wonderful people:\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n        \u003ctd align=\"center\" valign=\"top\" width=\"20%\"\u003e\n            \u003ca href=\"https://github.com/kmalakoff\"\u003e\n                \u003cimg src=\"https://avatars.githubusercontent.com/u/756520?s=120\u0026v=4\" width=\"60px;\" alt=\"@kmalakoff\"/\u003e\n                \u003cbr /\u003e\n                \u003cb\u003e@kmalakoff\u003c/b\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n        \u003ctd align=\"center\" valign=\"top\" width=\"20%\"\u003e\n            \u003ca href=\"https://github.com/SorsOps\"\u003e\n                \u003cimg src=\"https://avatars.githubusercontent.com/u/80043879?s=120\u0026v=4\" width=\"60px;\" alt=\"@SorsOps\"/\u003e\n                \u003cbr /\u003e\n                \u003cb\u003e@SorsOps\u003c/b\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n","funding_links":["https://github.com/sponsors/icelam","https://ko-fi.com/icelam"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelam%2Fhtml-inline-script-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficelam%2Fhtml-inline-script-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelam%2Fhtml-inline-script-webpack-plugin/lists"}