[
  {
    "path": ".cspell.json",
    "content": "{\n  \"version\": \"0.2\",\n  \"language\": \"en,en-gb\",\n  \"words\": [\n    \"commitlint\",\n    \"chunkhash\",\n    \"concat\",\n    \"systemjs\",\n    \"tapable\",\n    \"templatehash\",\n    \"blueimp\",\n    \"selfclosed\",\n    \"nocheck\",\n    \"iife\",\n    \"appcache\",\n    \"subresource\",\n    \"startuml\",\n    \"autonumber\",\n    \"enduml\",\n    \"chunksorter\",\n    \"urlencode\",\n    \"sortmode\",\n    \"harddisk\",\n    \"Sileghem\",\n    \"Bname\",\n    \"Bfile\",\n    \"webpackconfig\",\n    \"specialattribute\",\n    \"dircompare\",\n    \"wagoid\",\n    \"autocrlf\"\n  ],\n  \"ignorePaths\": [\n    \"CHANGELOG.md\",\n    \"coverage\",\n    \"package.json\",\n    \"**/dist/**\",\n    \"**/__snapshots__/**\",\n    \"**/fixtures/**\",\n    \"package-lock.json\",\n    \"node_modules\",\n    \"coverage\",\n    \"*.log\"\n  ]\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  env: {\n    node: true,\n    commonjs: true,\n    es2021: true,\n  },\n  extends: \"eslint:recommended\",\n  ignorePatterns: [\"**/dist/**/*.js\", \"**/spec/fixtures/**/*.js\"],\n  overrides: [\n    {\n      files: [\".eslintrc.{js,cjs}\"],\n      parserOptions: {\n        sourceType: \"script\",\n      },\n    },\n    {\n      env: {\n        browser: true,\n        es2021: true,\n      },\n      files: [\"**/examples/**\"],\n      parserOptions: {\n        sourceType: \"script\",\n      },\n    },\n  ],\n  parserOptions: {\n    ecmaVersion: \"latest\",\n  },\n  rules: {},\n};\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nopen_collective: html-webpack-plugin\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a 🕷 report to help us improve\n---\n\n<!-- If you deleting this template this issue is very likely to be closed -->\n\n## Current behaviour 💣\n\n<!-- Tell us which problem you are facing which might be caused by a bug in the html-webpack-plugin -->\n\n## Expected behaviour ☀️\n\n<!-- If not included in current behaviour please explain what should happen instead -->\n\n### Reproduction Example 👾\n\n<!--\n\nPlease provide a minimal example how to reproduce your problem..\nDelete all plugins which are unrelated\nDelete all loaders which are unrelated\nDelete the production webpack config if your bug happens on develop\nDelete the develop webpack config if your bug happens only on production\n\nFeel free to use this codebox template as a starting point: https://codesandbox.io/s/html-webpack-plugin-5x-alpha-d37s2?file=/webpack.config.js\n-->\n\n## Environment 🖥\n\n<!--\nTo help you we need to know which versions you using otherwise it is impossible to help you.\nPlease run the following commands to see your current versions:\n\n```\nnode -e \"var os=require('os');console.log('Node.js ' + process.version + '\\n' + os.platform() + ' ' + os.release())\"\nnpm --version\nnpm ls webpack\nnpm ls html-webpack-plugin\n```\n-->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/issue_template.md",
    "content": "<!-- CLICK \"Preview\" FOR INSTRUCTIONS IN A MORE READABLE FORMAT -->\n\n## Prerequisites\n\n- We realize there is a lot of data requested here. We ask only that you do your best to provide as much information as possible so we can better help you.\n- Support questions are better asked in one of the following locations:\n  - [Stack Overflow](http://stackoverflow.com/questions/tagged/html-webpack-plugin)\n- Ensure the issue isn't already reported.\n- Should be reproducible with the latest version of `html-webpack-plugin`.\n  - (Ensure `npm ls html-webpack-plugin` matches ![](https://img.shields.io/npm/v/html-webpack-plugin.svg))\n\n_Delete the above section and the instructions in the sections below before submitting_\n\n## Description\n\nIf this is a feature request, explain why it should be added. Specific use-cases are best.\n\nFor bug reports, please provide as much _relevant_ info as possible.\n\n### Error Message & Stack Trace\n\n```\nCOPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE\n```\n\n### Config\n\nCopy the relevant section from `webpack.config.js`:\n\n```js\nmodule.exports = {\n  entry: 'app.js',\n  output: {\n    path: 'dist',\n    filename: 'index_bundle.js'\n  },\n  module: {\n    rules: [\n      ...\n    ]\n  }\n  plugins: [\n    new HtmlWebpackPlugin(),\n    ...\n  ]\n}\n```\n\nCopy your template file:\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <title>My App</title>\n  </head>\n  <body></body>\n</html>\n```\n\n## Relevant Links\n\n- If your project is public, link to the repo so we can investigate directly.\n- **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support.\n\n## Environment\n\nTell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:\n\n```\nnode -e \"var os=require('os');console.log('Node.js ' + process.version + '\\n' + os.platform() + ' ' + os.release())\"\nnpm --version\nnpm ls webpack\nnpm ls html-webpack-plugin\n```\n"
  },
  {
    "path": ".github/lock.yml",
    "content": "# Configuration for lock-threads - https://github.com/dessant/lock-threads\n\n# Issues and pull requests with these labels will not be locked. Set to `[]` to disable\nexemptLabels: []\n\n# Label to add before locking, such as `outdated`. Set to `false` to disable\nlockLabel: false\n\n# Comment to post before locking. Set to `false` to disable\nlockComment: false\n\n# Number of days of inactivity before a closed issue or pull request is locked\ndaysUntilLock: 30\n"
  },
  {
    "path": ".github/stale.yml",
    "content": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 180\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 15\n# Issues with these labels will never be considered stale\nexemptLabels:\n  - pinned\n  - security\n# Label to use when marking an issue as stale\nstaleLabel: wontfix\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n  **This issue had no activity for at least half a year.**  \n  It's subject to automatic issue closing if there is no activity in the next 15 days.\n# Comment to post when closing a stale issue. Set to `false` to disable\ncloseComment: false\n"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "name: CI\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\njobs:\n  lint:\n    name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}\n\n    env:\n      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n    strategy:\n      matrix:\n        os: [ubuntu-latest]\n        node-version: [lts/*]\n\n    runs-on: ${{ matrix.os }}\n\n    concurrency:\n      group: lint-${{ matrix.os }}-v${{ matrix.node-version }}-${{ github.ref }}\n      cancel-in-progress: true\n\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          node-version: ${{ matrix.node-version }}\n          cache: \"npm\"\n\n      - name: Install dependencies\n        run: npm ci --legacy-peer-deps\n\n      - name: Lint\n        run: npm run lint\n\n      - name: Security audit\n        run: npm run security -- --only=prod\n\n      - name: Check commit message\n        uses: wagoid/commitlint-github-action@v5\n\n  build:\n    name: test Node ${{ matrix.node }} Webpack ${{ matrix.webpack }} ${{ matrix.os }}\n    timeout-minutes: 15\n\n    runs-on: ${{ matrix.os }}\n\n    concurrency:\n      group: ${{ github.workflow }}-${{ matrix.os }}-v${{ matrix.node }}-${{ matrix.webpack }}-${{ github.ref }}\n      cancel-in-progress: true\n\n    strategy:\n      matrix:\n        node:\n          [\n            \"10.x\",\n            \"12.x\",\n            \"14.x\",\n            \"16.x\",\n            \"18.x\",\n            \"20.x\",\n            \"22.x\",\n            \"24.x\",\n            \"25.x\",\n          ]\n        os: [ubuntu-latest, windows-latest, macOS-latest]\n        webpack: [latest]\n\n    steps:\n      - name: Setup Git\n        if: matrix.os == 'windows-latest'\n        run: git config --global core.autocrlf input\n\n      - uses: actions/checkout@v4\n\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          node-version: ${{ matrix.node-version }}\n          cache: \"npm\"\n\n      - name: Install dependencies\n        run: npm ci --legacy-peer-deps\n\n      - name: Install webpack ${{ matrix.webpack-version }}\n        if: matrix.webpack-version != 'latest'\n        run: npm i webpack@${{ matrix.webpack-version }} --legacy-peer-deps\n\n      - name: Run tests for webpack version ${{ matrix.webpack-version }}\n        run: npm run test:coverage -- --ci\n\n      - name: Submit coverage data to codecov\n        uses: codecov/codecov-action@v4\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules/\n/dist/\n/coverage/\nnpm-debug.*.log\nyarn.lock\nnpm-debug.log.*\n/.idea/\n.eslintcache\n.cspellcache\n"
  },
  {
    "path": ".husky/commit-msg",
    "content": "npx --no-install commitlint --edit $1\n"
  },
  {
    "path": ".husky/pre-commit",
    "content": "npx --no-install lint-staged\n"
  },
  {
    "path": ".mailmap",
    "content": "Chris Greening <chris@cmgresearch.com>\nJan Nicklas <j.nicklas@me.com>\nJan Nicklas <j.nicklas@me.com> <j.nicklas@sinnerschrader.com>\nMa Cheng <mc@mc-zone.me>\nMichał Gołębiowski-Owczarek <m.goleb@gmail.com>\nThomas Grainger <tom.grainger@procensus.com>\nThomas Grainger <tom.grainger@procensus.com> <tagrain@gmail.com>\nZhanwei Wu <zhanwei.wu@dbjtech.com>\n"
  },
  {
    "path": ".node-version",
    "content": "10.13.0\n"
  },
  {
    "path": ".prettierignore",
    "content": "/coverage\n/dist\n/node_modules\n/spec/fixtures\nCHANGELOG.md\nexamples/*/dist\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n### [5.6.6](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.5...v5.6.6) (2026-01-16)\n\n\n### Bug Fixes\n\n* compatibility with handlebars-loader ([#1882](https://github.com/jantimon/html-webpack-plugin/issues/1882)) ([a8e563b](https://github.com/jantimon/html-webpack-plugin/commit/a8e563b9872e98193ebca75a886fc2657711e722))\n\n### [5.6.5](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.4...v5.6.5) (2025-11-18)\n\n\n### Bug Fixes\n\n* localStorage exception in Node 25+ ([#1880](https://github.com/jantimon/html-webpack-plugin/issues/1880)) ([a25aa2e](https://github.com/jantimon/html-webpack-plugin/commit/a25aa2e0202fa35bbecf35cc45327dfc34ef938b))\n\n### [5.6.4](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.3...v5.6.4) (2025-08-14)\n\n\n### Bug Fixes\n\n* compilation.errors should contain Error objects ([#1877](https://github.com/jantimon/html-webpack-plugin/issues/1877)) ([b733b1a](https://github.com/jantimon/html-webpack-plugin/commit/b733b1a91875c85eb5c08c130c5538eda5c9d090))\n\n### [5.6.3](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.2...v5.6.3) (2024-10-23)\n\n\n### Bug Fixes\n\n* hooks file for old plugins ([#1867](https://github.com/jantimon/html-webpack-plugin/issues/1867)) ([0585a36](https://github.com/jantimon/html-webpack-plugin/commit/0585a364b2868a456713593540f738fe266d0028))\n\n### [5.6.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.1...v5.6.2) (2024-10-17)\n\n\n### Bug Fixes\n\n* allow bundle empty html ([#1865](https://github.com/jantimon/html-webpack-plugin/issues/1865)) ([f5b9140](https://github.com/jantimon/html-webpack-plugin/commit/f5b9140cc3232cb695453d8e5f3140a5af59acc8))\n\n### [5.6.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.0...v5.6.1) (2024-10-17)\n\n\n### Bug Fixes\n\n* avoid importing all of lodash ([#1864](https://github.com/jantimon/html-webpack-plugin/issues/1864)) ([2caf5db](https://github.com/jantimon/html-webpack-plugin/commit/2caf5db9641d487e07439f96d2840b940800aff5))\n* don't use `initialize` hooks to allow dynamic plugin injection ([ae85878](https://github.com/jantimon/html-webpack-plugin/commit/ae85878c3812b72d891ce368d81ce05b72c3748e))\n* handle `childCompilation.errors` being an iterator rather than array ([#1863](https://github.com/jantimon/html-webpack-plugin/issues/1863)) ([4c0c894](https://github.com/jantimon/html-webpack-plugin/commit/4c0c8943903e99ba01c7a50477ed5457513ba122))\n\n## [5.6.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.4...v5.6.0) (2023-12-19)\n\n\n### Features\n\n* add `@rspack/core` as an optional peer dependency ([#1829](https://github.com/jantimon/html-webpack-plugin/issues/1829)) ([56ff3ae](https://github.com/jantimon/html-webpack-plugin/commit/56ff3aeaf17a592bf2cfb25219cfdf5aad6cc47d))\n* Added support `type=systemjs-module` via the `scriptLoading` option ([#1822](https://github.com/jantimon/html-webpack-plugin/issues/1822)) ([7effc30](https://github.com/jantimon/html-webpack-plugin/commit/7effc30df89a6553a20bf7915d97daa067bb4173))\n\n\n### Bug Fixes\n\n* memory leak ([#1836](https://github.com/jantimon/html-webpack-plugin/issues/1836)) ([c79f2cf](https://github.com/jantimon/html-webpack-plugin/commit/c79f2cfdb3aaa6f1dbd87b64c7d13bc9ab21c59f))\n\n### [5.5.4](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.3...v5.5.4) (2023-12-06)\n\n\n### Bug Fixes\n\n* avoid have undefined `type` for script tags ([#1809](https://github.com/jantimon/html-webpack-plugin/issues/1809)) ([9959484](https://github.com/jantimon/html-webpack-plugin/commit/9959484f5337872f5af2a2f738228f5348a93901))\n* reemit assets from loaders ([#1811](https://github.com/jantimon/html-webpack-plugin/issues/1811)) ([a214736](https://github.com/jantimon/html-webpack-plugin/commit/a21473675c81dc4ac2ec8112741cbd52a2756dcc))\n* reemit favicon in serve/watch mode ([#1804](https://github.com/jantimon/html-webpack-plugin/issues/1804)) ([57c5a4e](https://github.com/jantimon/html-webpack-plugin/commit/57c5a4ebcfc4008686ae233f0c94434757c02329))\n\n### [5.5.3](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.2...v5.5.3) (2023-06-10)\n\n\n### Bug Fixes\n\n* don't add extra meta tag if it exists ([#1802](https://github.com/jantimon/html-webpack-plugin/issues/1802)) ([8f92788](https://github.com/jantimon/html-webpack-plugin/commit/8f927889a3a98d06472b662135954457385cc926))\n* pass all Node.js globals to templates ([#1796](https://github.com/jantimon/html-webpack-plugin/issues/1796)) ([f269fc0](https://github.com/jantimon/html-webpack-plugin/commit/f269fc01fe619c5a98388017770040dae6263928))\n* **types:** fix type for `chunkSortMode` ([#1798](https://github.com/jantimon/html-webpack-plugin/issues/1798)) ([6ad0e55](https://github.com/jantimon/html-webpack-plugin/commit/6ad0e556276da22b17747b15eb0e52bb9aa77c75))\n\n### [5.5.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.1...v5.5.2) (2023-06-08)\n\n\n### Bug Fixes\n\n* compatibility with ES modules output ([#1795](https://github.com/jantimon/html-webpack-plugin/issues/1795)) ([eda853b](https://github.com/jantimon/html-webpack-plugin/commit/eda853bbcc1e47be99352cf0b097da6011d3730e))\n\n### [5.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.0...v5.5.1) (2023-04-15)\n\n\n### Bug Fixes\n\n* **perf:** defer loading of pretty-error to improve startup time ([#1789](https://github.com/jantimon/html-webpack-plugin/issues/1789)) ([988709d](https://github.com/jantimon/html-webpack-plugin/commit/988709d8b0142d1654f66a94bbde4e5f40172242))\n\n## [5.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.4.0...v5.5.0) (2021-10-25)\n\n\n### Features\n\n* Support type=module via scriptLoading option ([1e42625](https://github.com/jantimon/html-webpack-plugin/commit/1e4262528ff02a83e1fc7739b42472680fd205c2)), closes [#1663](https://github.com/jantimon/html-webpack-plugin/issues/1663)\n\n### [5.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.2...v5.3.3) (2021-10-15)\n\n### Features\n\n* update terser ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/pull/1688)\n\n### [5.3.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.1...v5.3.2) (2021-06-22)\n\n### Bug Fixes\n\n* update lodash and pretty error ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/commit/9c7fba02d0aa7d9e804863a66eb896db3046f645)\n\n### [5.3.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.0...v5.3.1) (2021-03-09)\n\n\n### Bug Fixes\n\n* remove loader-utils from plugin core ([82d0ee8](https://github.com/jantimon/html-webpack-plugin/commit/82d0ee8ddf146f17d71e98c1b44b2f2ec7420051))\n\n## [5.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.2.0...v5.3.0) (2021-03-07)\n\n\n### Features\n\n* allow to modify the interpolation options in webpack config ([d654f5b](https://github.com/jantimon/html-webpack-plugin/commit/d654f5b90022304335b372d424ff4c08d3a9d341))\n* drop loader-utils dependency ([41d7a50](https://github.com/jantimon/html-webpack-plugin/commit/41d7a50516aefd1af2704e3837d5d41351c6199b))\n\n## [5.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.1.0...v5.2.0) (2021-02-19)\n\n\n### Features\n\n* improve ssr ([73d2a66](https://github.com/jantimon/html-webpack-plugin/commit/73d2a660b10b9ebf8a341f0ddb173bcaaf1e513c))\n\n## [5.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.0.0...v5.1.0) (2021-02-12)\n\n\n### Features\n\n* omit html tag attribute with null/undefined/false value ([aa6e78d](https://github.com/jantimon/html-webpack-plugin/commit/aa6e78d1430c17d9cf05550b2c9f73a9a0c0166c)), closes [#1598](https://github.com/jantimon/html-webpack-plugin/issues/1598)\n\n## [5.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v5.0.0) (2021-02-03)\n\n\n### ⚠ BREAKING CHANGES\n\n* Drop support for `webpack` 4 and `node` <= 10 - For older webpack or node versions please use `html-webpack-plugin` 4.x\n* Entry javascript resources are now being loaded deferred in the `<head>` tag to improve the page load performance by default - You can set the `scriptLoading` option to `'blocking'` to keep the previous behaviour\n* Setting publicPath to `''` (an empty string) will no longer calculate a relative path from the html file to the assets anymore - You can set the `publicPath` option to `'auto'` to keep the previous behaviour\n* Plugins for `html-webpack-plugin` which add additional assetTags should provide a `meta` attribute\n* Drop support for `appcache-webpack-plugin`\n\n### Features\n\n* drop `webpack` 4 and `node` <= 10 support to make use of the latest APIs ([b7a9e8f](https://github.com/jantimon/html-webpack-plugin/commit/b7a9e8f2a3c146cfec8f5c42888abd6aa0cde0b9))\n* use the new webpack 5 APIs and create html files during the new `webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS` compilation stage ([8964bc4](https://github.com/jantimon/html-webpack-plugin/commit/8964bc4182e41807a564d3000217a40bc5f93ad2), [b6895cb](https://github.com/jantimon/html-webpack-plugin/commit/b6895cb5b85b1e6e850f638470cf9b839d421516), [a97234e](https://github.com/jantimon/html-webpack-plugin/commit/a97234ead5ea2dbba07a6e6a70c5ddb6a5a3c288), [1b59e09](https://github.com/jantimon/html-webpack-plugin/commit/1b59e0944f561b264f11847ef245c9fc3f05b80f), [4fca596](https://github.com/jantimon/html-webpack-plugin/commit/4fca5965315c49f6706812d9fdf6c7284d23d75b), [ed64a6b](https://github.com/jantimon/html-webpack-plugin/commit/ed64a6b35fe9cdbc610e9b766700f3b2fc2b8e4c), [86245db](https://github.com/jantimon/html-webpack-plugin/commit/86245db670a9b3bdd0e2aba9f2031745a98434c7), [50b3bec](https://github.com/jantimon/html-webpack-plugin/commit/50b3bec51a43289d6d1b4e1e6439560eb791576f), [c697725](https://github.com/jantimon/html-webpack-plugin/commit/c697725e9f4dd990bd4b7927bbfa7b826d2f36f2))\n* allow generating one file per chunk with the new `'[name]'` placeholder for the `filename` option ([cd5bd2a](https://github.com/jantimon/html-webpack-plugin/commit/cd5bd2afc902bbe5a5ceec4756ef634a26aa1332), [3d9ff48](https://github.com/jantimon/html-webpack-plugin/commit/3d9ff48543d04d9f7c3440bfefb43751775a9e81))\n* the `filename` option can now be a function ([c5beb4b](https://github.com/jantimon/html-webpack-plugin/commit/c5beb4bd16e4916b5355c300abebf9d7d3c587da))\n* add support for `'auto'` public paths inside templates ([a059fcf](https://github.com/jantimon/html-webpack-plugin/commit/a059fcf32d94aaaa738359cedce0b0e4af68f0de), [b09b439](https://github.com/jantimon/html-webpack-plugin/commit/b09b439f50ecb75994acde2eb2967ad690ff1cf0))\n* use defer as default script loading mechanism ([35b6b87](https://github.com/jantimon/html-webpack-plugin/commit/35b6b878db17f0f5704a187b336a14fdd58cedfc))\n* allow to set publicPath to an empty string `''` ([5ea7de4](https://github.com/jantimon/html-webpack-plugin/commit/5ea7de4ba271813835be700316c8a1763b205d2d))\n* improve typings ([197ddd8](https://github.com/jantimon/html-webpack-plugin/commit/197ddd88f39a2e6e70863b6fed2385d33043d137))\n* provide public path to the alterAssetTagGroups hook ([1b54dfb](https://github.com/jantimon/html-webpack-plugin/commit/1b54dfbd62c0d0df10dd3d2be9937626142d518f))\n* provide public path to the alterAssetTags hook ([b754626](https://github.com/jantimon/html-webpack-plugin/commit/b75462653d11803a428b1d29479e259c3010163f))\n* use `thisCompilation` in child compiler for faster builds ([1d59e9a](https://github.com/jantimon/html-webpack-plugin/commit/1d59e9a71ddba1429168c42569a7bd9bdd363f4f))\n* export new major in static property ([8b692bd](https://github.com/jantimon/html-webpack-plugin/commit/8b692bd7cc0b75ddf55f47da317eed9bd19dab91))\n* reduce dependencies ([8c28aaa](https://github.com/jantimon/html-webpack-plugin/commit/8c28aaa2bed5a7147b397fef3801cfe8fb5c34b9), [56e633f](https://github.com/jantimon/html-webpack-plugin/commit/56e633fcb90909c2bbedbd63590ecaa825d8b31f))\n\n\n### Bug Fixes\n\n* emit files on every build to work properly with plugins like the \nclean-webpack-plugin ([6b3d087](https://github.com/jantimon/html-webpack-plugin/commit/6b3d087cf17f63b596c298d70a42a7462dd0f881))\n* generate html files even if no webpack entry exists ([2693dfa](https://github.com/jantimon/html-webpack-plugin/commit/2693dfaf4c94625eab86afadfd0e4d8822092d6b))\n* keep binary format when adding assets ([7e2b208](https://github.com/jantimon/html-webpack-plugin/commit/7e2b208634e26299c509e0c6b3189e01e4c3d3df)), closes [#1537](https://github.com/jantimon/html-webpack-plugin/issues/1537)\n\n## [4.5.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v4.5.2) (2021-02-18)\n\n\n### Bug Fixes\n\n* more robust variable value extraction to add support for webpack >= 5.22.0 ([1aabaf9](https://github.com/jantimon/html-webpack-plugin/commit/1aabaf99820257cbe7d3efccb62b42254ad35e04))\n\n### [4.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.0...v4.5.1) (2021-01-03)\n\n\n### Bug Fixes\n\n* inject javascripts in the <head> tag for inject:true and scriptLoading:'defer' ([4f7064e](https://github.com/jantimon/html-webpack-plugin/commit/4f7064ee56fe710e8f416018956647a72c270fb1))\n\n# [4.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.1...v4.5.0) (2020-09-21)\n\n\n### Features\n\n* Add publicPath option to overrule the default path generation ([#1516](https://github.com/jantimon/html-webpack-plugin/issues/1516)) ([19b5122](https://github.com/jantimon/html-webpack-plugin/commit/19b5122))\n* update webpack dependency range to allow installing webpack 5 beta  ([f3ccdd5](https://github.com/jantimon/html-webpack-plugin/commit/f3ccdd5)), closes [#1504](https://github.com/jantimon/html-webpack-plugin/issues/1504)\n\n\n\n## [4.4.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.0...v4.4.1) (2020-08-30)\n\n\n### Bug Fixes\n\n* broken typings.d.ts in v4.4.0 ([#1503](https://github.com/jantimon/html-webpack-plugin/issues/1503)) ([98ad756](https://github.com/jantimon/html-webpack-plugin/commit/98ad756))\n\n\n\n# [4.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.3.0...v4.4.0) (2020-08-30)\n\n\n### Bug Fixes\n\n* fix typos in comments ([#1484](https://github.com/jantimon/html-webpack-plugin/issues/1484)) ([6b0711e](https://github.com/jantimon/html-webpack-plugin/commit/6b0711e))\n\n\n### Features\n\n* added v5 compilation support and deleted depreciation warnings ([4ae7be8](https://github.com/jantimon/html-webpack-plugin/commit/4ae7be8)), closes [#1454](https://github.com/jantimon/html-webpack-plugin/issues/1454)\n\n\n\n# [4.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.2...v4.3.0) (2020-04-30)\n\n\n### Features\n\n* Allow to use console.log inside templates ([c3f2fdc](https://github.com/jantimon/html-webpack-plugin/commit/c3f2fdc))\n\n\n\n## [4.2.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.1...v4.2.2) (2020-04-30)\n\n\n### Bug Fixes\n\n* Prevent \"cannot read property info of undefined\" when reading meta information from assets ([253ce30](https://github.com/jantimon/html-webpack-plugin/commit/253ce30))\n* use modern icon tag rel attribute for favicons ([c40dd85](https://github.com/jantimon/html-webpack-plugin/commit/c40dd85))\n\n\n\n## [4.2.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.0...v4.2.1) (2020-04-28)\n\n\n### Bug Fixes\n\n* don't add dependencies twice to the webpack 5 watcher api ([ceafe14](https://github.com/jantimon/html-webpack-plugin/commit/ceafe143650749a5f53a14411dc1b762e252ec44))\n* prevent scripts marked as hotModuleReplacement from being added to the html file ([119252a](https://github.com/jantimon/html-webpack-plugin/commit/119252a381bf43dea37c1be64f90c10bebc21302))\n\n\n\n# [4.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.1.0...v4.2.0) (2020-04-09)\n\n\n### Features\n\n* Add template content ([#1401](https://github.com/jantimon/html-webpack-plugin/issues/1401)) ([4740bf7](https://github.com/jantimon/html-webpack-plugin/commit/4740bf7))\n\n\n\n# [4.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.4...v4.1.0) (2020-04-09)\n\n\n### Features\n\n* Add webpack 5 support ([39c38a4](https://github.com/jantimon/html-webpack-plugin/commit/39c38a4))\n* Allow webpack 5 as peer dependency ([9c571e2](https://github.com/jantimon/html-webpack-plugin/commit/9c571e2))\n\n\n\n## [4.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.3...v4.0.4) (2020-04-01)\n\n\n### Bug Fixes\n\n* Fix querystring encoding ([#1386](https://github.com/jantimon/html-webpack-plugin/issues/1386)) ([4f48a39](https://github.com/jantimon/html-webpack-plugin/commit/4f48a39e5738a5d431be2bec39c1b1f0de800d57)), closes [#1355](https://github.com/jantimon/html-webpack-plugin/issues/1355)\n\n\n\n## [4.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.2...v4.0.3) (2020-03-28)\n\n\n### Bug Fixes\n\n* add webpack, tapable and html-minifier-terser as dependencies because of types.d.ts ([238da81](https://github.com/jantimon/html-webpack-plugin/commit/238da8123950f87267954fd448f3e6b0fb1ead17))\n\n\n\n## [4.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.1...v4.0.2) (2020-03-26)\n\n\n### Bug Fixes\n\n* don't remove trailing slashes from self closing tags by default ([2281e4b](https://github.com/jantimon/html-webpack-plugin/commit/2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e))\n\n\n\n## [4.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.0...v4.0.1) (2020-03-23)\n\n\n### Bug Fixes\n\n* update typedefs to match with html-minifier-terser ([2698c7e](https://github.com/jantimon/html-webpack-plugin/commit/2698c7e45a7f12113a07b256dc400ec89666130d))\n\n\n\n# [4.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.0) (2020-03-23)\n\nThe summary can be found in the [**release blog post**](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d).\n\n### Bug Fixes\n\n* Add dependencies from the child compilation to the main compilation ([27c3e72](https://github.com/jantimon/html-webpack-plugin/commit/27c3e727b073701bfc739859d8325435d27cbf35))\n* Add typing for assets(Close jantimon[#1243](https://github.com/jantimon/html-webpack-plugin/issues/1243)) ([9fef060](https://github.com/jantimon/html-webpack-plugin/commit/9fef0603eb532b3e6a1e8871b4568e62f9bba1a3))\n* allow `contenthash` along with `templatehash` ([049d4d3](https://github.com/jantimon/html-webpack-plugin/commit/049d4d3436092b8beff3f5745e77b20f1c168c4c)), closes [#1033](https://github.com/jantimon/html-webpack-plugin/issues/1033)\n* Catch and ignore pretty-error errors ([2056139](https://github.com/jantimon/html-webpack-plugin/commit/2056139a9533ff9487506531491c0e5a94003607)), closes [#921](https://github.com/jantimon/html-webpack-plugin/issues/921)\n* Drop @types/webpack dependency ([d4eb1c7](https://github.com/jantimon/html-webpack-plugin/commit/d4eb1c749316af3964126606fe6c70a233c30fef))\n* Ignore foreign child compilers ([1422664](https://github.com/jantimon/html-webpack-plugin/commit/14226649aa1bbaf7b174bcacafdbe47d8ba6c851))\n* Improve perfomance for appcache files ([b94e043](https://github.com/jantimon/html-webpack-plugin/commit/b94e0434f5dbb06ee2179e91ebaa2ce7801937e0))\n* load script files before style files files in defer script loading mode ([97f9fb9](https://github.com/jantimon/html-webpack-plugin/commit/97f9fb9a68e4d3c3c9453296c352e831f7546937))\n* Prevent chunks from beeing added multiple times ([d65b37d](https://github.com/jantimon/html-webpack-plugin/commit/d65b37d2c588047e0d81a38f4645fcdb3ead0b9e))\n* Prevent lodash from being inlined to work around a babel-loader incompatibility ([7f21910](https://github.com/jantimon/html-webpack-plugin/commit/7f21910707a2b53a9a5da3ac9e4b01e36147402f)), closes [#1223](https://github.com/jantimon/html-webpack-plugin/issues/1223)\n* Remove compilation.getStats() call for performance reasons ([7005a55](https://github.com/jantimon/html-webpack-plugin/commit/7005a557529bee948c5ef0a1b8b44a1a41a28417))\n* remove useless links for options ([#1153](https://github.com/jantimon/html-webpack-plugin/issues/1153)) ([267e0e0](https://github.com/jantimon/html-webpack-plugin/commit/267e0e0eac155569c822c34f120490bdf3f56d43))\n* Update references to html-minifier ([24bf1b5](https://github.com/jantimon/html-webpack-plugin/commit/24bf1b5e2a0d087b30d057d1780d8f495aa01e26)), closes [#1311](https://github.com/jantimon/html-webpack-plugin/issues/1311)\n* **typings.d.ts:** added apply method type to HtmlWwbpackPlugin class definitoin ([8b7255f](https://github.com/jantimon/html-webpack-plugin/commit/8b7255f555423dd1bfa51a3c28700e4bd116f97b)), closes [jantimon#1244](https://github.com/jantimon/issues/1244)\n* rename `contenthash` to `templatehash` ([4c11c5d](https://github.com/jantimon/html-webpack-plugin/commit/4c11c5dfde9d87d71dce9cf51864648f8e42b912))\n* Repair typings ([#1166](https://github.com/jantimon/html-webpack-plugin/issues/1166)) ([f4cb241](https://github.com/jantimon/html-webpack-plugin/commit/f4cb241157a9a1fed4721b1abc1f390b09595494))\n* small type. minifcation instead of minification ([#1154](https://github.com/jantimon/html-webpack-plugin/issues/1154)) ([56037a6](https://github.com/jantimon/html-webpack-plugin/commit/56037a6b2ae4a7606b54f5af213b6a2b8145f95e))\n* Use src/index.ejs by default if present ([#1167](https://github.com/jantimon/html-webpack-plugin/issues/1167)) ([c27e5e4](https://github.com/jantimon/html-webpack-plugin/commit/c27e5e46a334d9c1e177a521ea7c9a5ba3c6d980))\n* **chunksorter:** Don't sort chunks by default ([22fb03f](https://github.com/jantimon/html-webpack-plugin/commit/22fb03fb17fdb37d5ce6de00af154b5575a02d3a))\n* **loader:** switch to loaderUtils.getOptions ([a0a0f0d](https://github.com/jantimon/html-webpack-plugin/commit/a0a0f0dc755fbc3249aa2e1d1c6a4dd307ab8e8a))\n* **README:** adds a link to template option documentation ([f40aeae](https://github.com/jantimon/html-webpack-plugin/commit/f40aeae312af73c6c5263cd99e81069f41d3b699))\n* **tests:** Upgrade webpack-recompilation-simulator ([dfe1d10](https://github.com/jantimon/html-webpack-plugin/commit/dfe1d10c4511b0da4354cacf79ca0d5ac7baf862))\n* Update lodash to 4.17.10 ([cc3bf49](https://github.com/jantimon/html-webpack-plugin/commit/cc3bf4909605879993c22e3048ee520dbdc8fa49))\n\n\n### Code Refactoring\n\n* Change the structure of the internal assets object ([37db086](https://github.com/jantimon/html-webpack-plugin/commit/37db0868efdbf334a1b60003fe5bd376cfd8ae01))\n* Changed hook names and arguments - the hook order is 'beforeAssetTagGeneration', 'alterAssetTags', 'alterAssetTagGroups', 'afterTemplateExecution', 'beforeEmit', 'afterEmit' ([14b4456](https://github.com/jantimon/html-webpack-plugin/commit/14b4456ba67a5b85421b558bbd5f1d59c7b410b3))\n* Use Webpack 4 APIs ([47efdea](https://github.com/jantimon/html-webpack-plugin/commit/47efdeaf17806f7d4e26aefacc748a92077f904a))\n\n\n### Features\n\n* add `.toString` implementation to htmlTags to allow easier rendering ([34d8aa5](https://github.com/jantimon/html-webpack-plugin/commit/34d8aa572c7acc59c26f3b5d15bf489a07aa4c24))\n* Add default viewport meta tag for default template ([302e39e](https://github.com/jantimon/html-webpack-plugin/commit/302e39e30013b5828bb6c9e7036db951f70d0cf5)), closes [#897](https://github.com/jantimon/html-webpack-plugin/issues/897) [#978](https://github.com/jantimon/html-webpack-plugin/issues/978)\n* Add defer script loading ([de315eb](https://github.com/jantimon/html-webpack-plugin/commit/de315eb98497f3e5f517d59dbbe120b48c9b8db9))\n* Add support for relative publicPath   ([dbbdd81](https://github.com/jantimon/html-webpack-plugin/commit/dbbdd81de570dd181ea0905a6445fdeb5a784912))\n* Add support for <base> tag ([#1160](https://github.com/jantimon/html-webpack-plugin/issues/1160)) ([c5d4b86](https://github.com/jantimon/html-webpack-plugin/commit/c5d4b869c196c59cdd6a9c30db58f1f8be07a820))\n* Add support for minifying inline ES6 inside html templates ([c66766c](https://github.com/jantimon/html-webpack-plugin/commit/c66766cdae3593091dee413b9c585359c24ef068)), closes [#1262](https://github.com/jantimon/html-webpack-plugin/issues/1262)\n* Add support for the [contenthash] placeholder inside htm file names ([ae8233a](https://github.com/jantimon/html-webpack-plugin/commit/ae8233a04d4105b6e970feaa2c5e11c0b48fd4b7))\n* Add typings to package.json ([a524e8f](https://github.com/jantimon/html-webpack-plugin/commit/a524e8f24e905d5e51fedd50d33a41328a9b87eb)), closes [#1132](https://github.com/jantimon/html-webpack-plugin/issues/1132)\n* Allow to return async template parameters ([99f9362](https://github.com/jantimon/html-webpack-plugin/commit/99f9362703055baf0029b8852cb5339b6218829d))\n* drop workaround for \"Uncaught TypeError: __webpack_require__(...) is not a function\" to be compatible with webpack 5 ([15ad0d2](https://github.com/jantimon/html-webpack-plugin/commit/15ad0d260443edfdcc953fa08c675c90c063bac7))\n* Export major version of this plugin ([6ae6f48](https://github.com/jantimon/html-webpack-plugin/commit/6ae6f48ecf92b080809d68092ee8c6825edfe5a4))\n* merge templateParameters with default template parameters ([1d66e53](https://github.com/jantimon/html-webpack-plugin/commit/1d66e5333bc2aeb8caadf96e572af756d3708d19))\n* Provide a verbose error message if html minification failed ([7df269f](https://github.com/jantimon/html-webpack-plugin/commit/7df269fd2a840d0800cb259bd559edb0b766e7ab))\n* **compiler:** Add file dependencies ([bbc07a3](https://github.com/jantimon/html-webpack-plugin/commit/bbc07a3a214e3b693e6c9e3d6404e146a0fc023a))\n* **compiler:** Use a single compiler for multiple plugin instances ([f29ae88](https://github.com/jantimon/html-webpack-plugin/commit/f29ae886d7fad50e7fbb78ac7ff7d5bd9bc47f49))\n* **compiler:** Use timestamps to verify cache validity ([0ebcd17](https://github.com/jantimon/html-webpack-plugin/commit/0ebcd1776132262b799f2814659f4d90c3f3c1b3))\n* Remove selfClosingTag ([5d3d8e4](https://github.com/jantimon/html-webpack-plugin/commit/5d3d8e4b73b7b97dba8bdf5fe1ecf50598040b54))\n* Remove type=\"text/javascript\" from injected script tags ([b46bf67](https://github.com/jantimon/html-webpack-plugin/commit/b46bf67ae4492a12b60c42c7d26831e480522b49))\n* Replace jade with pug in examples ([d7ec407](https://github.com/jantimon/html-webpack-plugin/commit/d7ec4078c85b3ed9c2ff84e10fe75392f26a6130))\n* Switch from jasmine to jest ([ae1f435](https://github.com/jantimon/html-webpack-plugin/commit/ae1f43527945c8ae953c2ba549631f2d090e003a))\n* **hooks:** Add a helper for easier hook access ([b6dec4b](https://github.com/jantimon/html-webpack-plugin/commit/b6dec4bf1072509282756e8d83ef6ee447485f3a))\n* **hooks:** Provide static getHook method for access to all html-webpack-plugin hooks ([#995](https://github.com/jantimon/html-webpack-plugin/issues/995)) ([82b34a1](https://github.com/jantimon/html-webpack-plugin/commit/82b34a1dd2e96cbcd715fafe4e97073efd30cc9f))\n* Simplify <meta> element and charset attribute ([55313be](https://github.com/jantimon/html-webpack-plugin/commit/55313bee9b82ea79157085e48bba4fa2ebfef6a4))\n* support ES6 template string in default loader ([d6b65dd](https://github.com/jantimon/html-webpack-plugin/commit/d6b65dd1531038deac1be87c2087da5955903d24)), closes [#950](https://github.com/jantimon/html-webpack-plugin/issues/950)\n* Use jsdoc for static typing ([a6b8d2d](https://github.com/jantimon/html-webpack-plugin/commit/a6b8d2dcf3b1183d50589b869162b972ad32de4d))\n* Use webpack 4 entries api to extract asset information ([342867e](https://github.com/jantimon/html-webpack-plugin/commit/342867e1edb7c2a8748b0aca396f160f0b13d42e))\n* **html-tags:** Add a helper to create html-tags ([ee6a165](https://github.com/jantimon/html-webpack-plugin/commit/ee6a165425a6b47dff341fb651848ec5727d7f7e))\n\n\n### BREAKING CHANGES\n\n* **defaults:** Use src/index.ejs if no template option is set.\n* **defaults:** The default template has now a predefined viewport meta tag\n* **defaults:** The default meta utf-8 declaration was changed to <meta charset=\"utf-8\"/>\n* **hooks:** Renamed beforeHtmlGeneration hook to beforeAssetTagGeneration\n* **hooks:** Renamed beforeHtmlProcessing hook to alterAssetTags\n* **hooks:** Renamed afterHtmlProcessing hook to beforeEmit\n* **hooks:** The html-webpack-plugin doesn't add its hooks to the compilation object anymore\n* The assets object which is used for the template parameters and inside hooks was changed. The chunks property was removed and the js and css property was converted from a string into an object `{ entryName: string, path: string}`\n* The mimetype information \"text/javascript\" is removed from all generated script\ntags\n* Remove selfClosingTag attribute\n* Template strings inside templates are now disabled by default\n* Dropped support for Webpack 1 - 3\n* Template variable webpack was removed\n* **chunksorter:** Chunks aren't sorted anymore by default\n\n\n<a name=\"3.2.0\"></a>\n# [3.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.1.0...v3.2.0) (2018-04-03)\n\n\n### Bug Fixes\n\n* **loader:** Allow to add new template parameters ([f7eac19](https://github.com/jantimon/html-webpack-plugin/commit/f7eac19)), closes [#915](https://github.com/jantimon/html-webpack-plugin/issues/915)\n* **loader:** Use lodash inside the loader directly ([7b4eb7f](https://github.com/jantimon/html-webpack-plugin/commit/7b4eb7f)), closes [#786](https://github.com/jantimon/html-webpack-plugin/issues/786)\n\n\n### Features\n\n* Add meta tag option ([a7d37ca](https://github.com/jantimon/html-webpack-plugin/commit/a7d37ca))\n* Support node 6.9 ([74a22c4](https://github.com/jantimon/html-webpack-plugin/commit/74a22c4)), closes [#918](https://github.com/jantimon/html-webpack-plugin/issues/918)\n\n\n\n<a name=\"3.1.0\"></a>\n# [3.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.8...v3.1.0) (2018-03-22)\n\n\n### Features\n\n* Allow to overwrite the templateParameter [#830](https://github.com/jantimon/html-webpack-plugin/issues/830) ([c5e32d3](https://github.com/jantimon/html-webpack-plugin/commit/c5e32d3))\n\n\n\n<a name=\"3.0.8\"></a>\n## [3.0.8](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.7...v3.0.8) (2018-03-22)\n\n\n### Bug Fixes\n\n* **compiler:** Fallback to 3.0.7 because of [#900](https://github.com/jantimon/html-webpack-plugin/issues/900) ([05ee29b](https://github.com/jantimon/html-webpack-plugin/commit/05ee29b))\n\n\n\n<a name=\"3.0.7\"></a>\n## [3.0.7](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.6...v3.0.7) (2018-03-19)\n\n\n### Bug Fixes\n\n* **compiler:** Set single entry name [#895](https://github.com/jantimon/html-webpack-plugin/issues/895) ([26dcb98](https://github.com/jantimon/html-webpack-plugin/commit/26dcb98))\n\n\n\n<a name=\"3.0.6\"></a>\n## [3.0.6](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.5...v3.0.6) (2018-03-06)\n\n\n### Bug Fixes\n\n* **hooks:** Call tapable.apply directly [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([bcbb036](https://github.com/jantimon/html-webpack-plugin/commit/bcbb036))\n\n\n\n<a name=\"3.0.5\"></a>\n## [3.0.5](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.5) (2018-03-06)\n\n\n### Bug Fixes\n\n* **entries:** do not ignore JS if there is also CSS ([020b714](https://github.com/jantimon/html-webpack-plugin/commit/020b714))\n* **entries:** Don't add css entries twice ([0348d6b](https://github.com/jantimon/html-webpack-plugin/commit/0348d6b))\n* **hooks:** Remove deprecated tapable calls [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([2288f20](https://github.com/jantimon/html-webpack-plugin/commit/2288f20))\n\n\n\n<a name=\"3.0.4\"></a>\n## [3.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.4) (2018-03-01)\n\n\n### Bug Fixes\n\n* **entries:** Don't add css entries twice ([e890f23](https://github.com/jantimon/html-webpack-plugin/commit/e890f23))\n\n\n\n<a name=\"3.0.3\"></a>\n## [3.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.3) (2018-03-01)\n\n\n### Refactor\n\n* **performance:** Reduce the amount of chunk information gathered based on #825 ([06c59a7](https://github.com/jantimon/html-webpack-plugin/commit/06c59a7))\n\n\n<a name=\"3.0.2\"></a>\n## [3.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.1...v3.0.2) (2018-03-01)\n\n\n### Bug Fixes\n\n* **query-loader:** In case no query is provided, return an empty object. This fixes #727 ([7587754](https://github.com/jantimon/html-webpack-plugin/commit/7587754))\n\n\n\n<a name=\"3.0.1\"></a>\n## [3.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.0...v3.0.1) (2018-03-01)\n\n\n### Bug Fixes\n\n* **package:** Remove the extract-text-webpack-plugin peer dependency ([57411a9](https://github.com/jantimon/html-webpack-plugin/commit/57411a9))\n\n<a name=\"3.0.0\"></a>\n## [3.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v2.30.1...v3.0.0) (2018-28-02)\n\n### Features\n\n* Add support for the new [webpack tapable](https://github.com/webpack/tapable) to be compatible with webpack 4.x\n* Remove bluebird dependency\n\n### BREAKING CHANGES\n\n* Similar to webpack 4.x the support for node versions older than 6 are no longer supported\n\n<a name=\"2.30.1\"></a>\n## 2.30.1\n\n* Revert part the performance optimization ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723)) because of [#753](https://github.com/jantimon/html-webpack-plugin/issues/753).\n\n<a name=\"2.30.0\"></a>\n## 2.30.0\n\n* Add manual sort\n* Performance improvements ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723))\n\n<a name=\"2.29.0\"></a>\n## 2.29.0\n\n* Add support for Webpack 3\n\n<a name=\"2.28.0\"></a>\n## 2.28.0\n\n* Backport 3.x void tag for plugin authors\n\n<a name=\"2.27.1\"></a>\n## 2.27.1\n\n* Revert 2.25.0 loader resolving\n\n<a name=\"2.27.0\"></a>\n## 2.27.0\n\n* Fix a chunksorter webpack 2 issue ([#569](https://github.com/jantimon/html-webpack-plugin/pull/569))\n* Fix template path resolving ([#542](https://github.com/jantimon/html-webpack-plugin/pull/542))\n\n<a name=\"2.26.0\"></a>\n## 2.26.0\n\n* Allow plugins to add attributes without values to the `<script>` and `<link>` tags\n\n<a name=\"2.25.0\"></a>\n## 2.25.0\n\n* Clearer loader output\n* Add basic support for webpack 2\n\n<a name=\"2.24.1\"></a>\n## 2.24.1\n\n* Hide event deprecated warning of 'applyPluginsAsyncWaterfall' for html-webpack-plugin-after-emit and improve the warning message.\n\n<a name=\"2.24.0\"></a>\n## 2.24.0\n\n* Update dependencies\n* Add deprecate warning for plugins not returning a result\n* Add [path] for favicons\n\n<a name=\"2.23.0\"></a>\n## 2.23.0\n\n* Update dependencies\n* Stop automated tests for webpack 2 beta because of [#401](https://github.com/jantimon/html-webpack-plugin/issues/401)\n\n<a name=\"2.22.0\"></a>\n## 2.22.0\n\n* Update dependencies\n\n<a name=\"2.21.1\"></a>\n## 2.21.1\n\n* Better error handling ([#354](https://github.com/jantimon/html-webpack-plugin/pull/354))\n\n<a name=\"2.21.0\"></a>\n## 2.21.0\n\n* Add `html-webpack-plugin-alter-asset-tags` event to allow plugins to adjust the script/link tags\n\n<a name=\"2.20.0\"></a>\n## 2.20.0\n\n* Exclude chunks works now even if combined with dependency sort\n\n<a name=\"2.19.0\"></a>\n## 2.19.0\n\n* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation\n\n<a name=\"2.18.0\"></a>\n## 2.18.0\n\n* Updated all dependencies\n\n<a name=\"2.17.0\"></a>\n## 2.17.0\n\n* Add `type` attribute to `script` element to prevent issues in Safari 9.1.1\n\n<a name=\"2.16.2\"></a>\n## 2.16.2\n\n* Fix bug introduced by 2.16.2. Fixes  [#315](https://github.com/jantimon/html-webpack-plugin/issues/315)\n\n<a name=\"2.16.1\"></a>\n## 2.16.1\n\n* Fix hot module replacement for webpack 2.x\n\n<a name=\"2.16.0\"></a>\n## 2.16.0\n\n* Add support for dynamic filenames like index[hash].html\n\n<a name=\"2.15.0\"></a>\n## 2.15.0\n\n* Add full unit test coverage for the webpack 2 beta version\n* For webpack 2 the default sort will be 'dependency' instead of 'id'\n* Upgrade dependencies\n\n<a name=\"2.14.0\"></a>\n## 2.14.0\n\n* Export publicPath to the template\n* Add example for inlining css and js\n\n<a name=\"2.13.0\"></a>\n## 2.13.0\n\n* Add support for absolute output file names\n* Add support for relative file names outside the output path\n\n<a name=\"2.12.0\"></a>\n## 2.12.0\n\n* Basic Webpack 2.x support #225\n\n<a name=\"2.11.0\"></a>\n## 2.11.0\n\n* Add `xhtml` option which is turned of by default. When activated it will inject self closed `<link href=\"..\" />` tags instead of unclosed `<link href=\"..\">` tags. ([#255](https://github.com/ampedandwired/html-webpack-plugin/pull/255))\n* Add support for webpack placeholders inside the public path e.g. `'/dist/[hash]/'`. ([#249](https://github.com/ampedandwired/html-webpack-plugin/pull/249))\n\n<a name=\"2.10.0\"></a>\n## 2.10.0\n\n* Add `hash` field to the chunk object\n* Add `compilation` field to the templateParam object ([#237](https://github.com/ampedandwired/html-webpack-plugin/issues/237))\n* Add `html-webpack-plugin-before-html-generation` event\n* Improve error messages\n\n<a name=\"2.9.0\"></a>\n## 2.9.0\n\n* Fix favicon path ([#185](https://github.com/ampedandwired/html-webpack-plugin/issues/185), [#208](https://github.com/ampedandwired/html-webpack-plugin/issues/208), [#215](https://github.com/ampedandwired/html-webpack-plugin/pull/215))\n\n<a name=\"2.8.2\"></a>\n## 2.8.2\n\n* Support relative URLs on Windows ([#205](https://github.com/ampedandwired/html-webpack-plugin/issues/205))\n\n<a name=\"2.8.1\"></a>\n## 2.8.1\n\n* Caching improvements ([#204](https://github.com/ampedandwired/html-webpack-plugin/issues/204))\n\n<a name=\"2.8.0\"></a>\n## 2.8.0\n\n* Add `dependency` mode for `chunksSortMode` to sort chunks based on their dependencies with each other\n\n<a name=\"2.7.2\"></a>\n## 2.7.2\n\n* Add support for require in js templates\n\n<a name=\"2.7.1\"></a>\n## 2.7.1\n\n* Refactoring\n* Fix relative windows path\n\n<a name=\"2.6.5\"></a>\n## 2.6.5\n\n* Minor refactoring\n\n<a name=\"2.6.4\"></a>\n## 2.6.4\n\n* Fix for `\"Uncaught TypeError: __webpack_require__(...) is not a function\"`\n* Fix incomplete cache modules causing \"HtmlWebpackPlugin Error: No source available\"\n* Fix some issues on Windows\n\n<a name=\"2.6.3\"></a>\n## 2.6.3\n\n* Prevent parsing the base template with the html-loader\n\n<a name=\"2.6.2\"></a>\n## 2.6.2\n\n* Fix `lodash` resolve error ([#172](https://github.com/ampedandwired/html-webpack-plugin/issues/172))\n\n<a name=\"2.6.1\"></a>\n## 2.6.1\n\n* Fix missing module ([#164](https://github.com/ampedandwired/html-webpack-plugin/issues/164))\n\n<a name=\"2.6.0\"></a>\n## 2.6.0\n\n* Move compiler to its own file\n* Improve error messages\n* Fix global HTML_WEBPACK_PLUGIN variable\n\n<a name=\"2.5.0\"></a>\n## 2.5.0\n\n* Support `lodash` template's HTML _\"escape\"_ delimiter (`<%- %>`)\n* Fix bluebird warning ([#130](https://github.com/ampedandwired/html-webpack-plugin/issues/130))\n* Fix an issue where incomplete cache modules were used\n\n<a name=\"2.4.0\"></a>\n## 2.4.0\n\n* Don't recompile if the assets didn't change\n\n<a name=\"2.3.0\"></a>\n## 2.3.0\n\n* Add events `html-webpack-plugin-before-html-processing`, `html-webpack-plugin-after-html-processing`, `html-webpack-plugin-after-emit` to allow other plugins to alter the html this plugin executes\n\n<a name=\"2.2.0\"></a>\n## 2.2.0\n\n* Inject css and js even if the html file is incomplete ([#135](https://github.com/ampedandwired/html-webpack-plugin/issues/135))\n* Update dependencies\n\n<a name=\"2.1.0\"></a>\n## 2.1.0\n\n* Synchronize with the stable `@1` version\n\n<a name=\"2.0.4\"></a>\n## 2.0.4\n\n* Fix `minify` option\n* Fix missing hash interpolation in publicPath\n\n<a name=\"2.0.3\"></a>\n## 2.0.3\n\n* Add support for webpack.BannerPlugin\n\n<a name=\"2.0.2\"></a>\n## 2.0.2\n\n* Add support for loaders in templates ([#41](https://github.com/ampedandwired/html-webpack-plugin/pull/41))\n* Remove `templateContent` option from configuration\n* Better error messages\n* Update dependencies\n\n\n<a name=\"1.7.0\"></a>\n## 1.7.0\n\n* Add `chunksSortMode` option to configuration to control how chunks should be sorted before they are included to the html\n* Don't insert async chunks into html ([#95](https://github.com/ampedandwired/html-webpack-plugin/issues/95))\n* Update dependencies\n\n<a name=\"1.6.2\"></a>\n## 1.6.2\n\n* Fix paths on Windows\n* Fix missing hash interpolation in publicPath\n* Allow only `false` or `object` in `minify` configuration option\n\n<a name=\"1.6.1\"></a>\n## 1.6.1\n\n* Add `size` field to the chunk object\n* Fix stylesheet `<link>`s being discarded when used with `\"inject: 'head'\"`\n* Update dependencies\n\n<a name=\"1.6.0\"></a>\n## 1.6.0\n\n* Support placing templates in subfolders\n* Don't include chunks with undefined name ([#60](https://github.com/ampedandwired/html-webpack-plugin/pull/60))\n* Don't include async chunks\n\n<a name=\"1.5.2\"></a>\n## 1.5.2\n\n* Update dependencies (lodash)\n\n<a name=\"1.5.1\"></a>\n## 1.5.1\n\n* Fix error when manifest is specified ([#56](https://github.com/ampedandwired/html-webpack-plugin/issues/56))\n\n<a name=\"1.5.0\"></a>\n## 1.5.0\n\n* Allow to inject javascript files into the head of the html page\n* Fix error reporting\n\n<a name=\"1.4.0\"></a>\n## 1.4.0\n\n* Add `favicon.ico` option\n* Add html minifcation\n\n<a name=\"1.2.0\"></a>\n## 1.2.0\n\n* Set charset using HTML5 meta attribute\n* Reload upon change when using webpack watch mode\n* Generate manifest attribute when using\n  [appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)\n* Optionally add webpack hash as a query string to resources included in the HTML\n  (`hash: true`) for cache busting\n* CSS files generated using webpack (for example, by using the\n  [extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))\n  are now automatically included into the generated HTML\n* More detailed information about the files generated by webpack is now available\n  to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more\n  details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.\n* The `templateContent` option can now be a function that returns the template string to use\n* Expose webpack configuration to templates (`o.webpackConfig`)\n* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "[![npm][npm]][npm-url]\n[![node][node]][node-url]\n![npm](https://img.shields.io/npm/dw/html-webpack-plugin.svg)\n[![tests][tests]][tests-url]\n[![Backers on Open Collective](https://opencollective.com/html-webpack-plugin/backers/badge.svg)](#backers)\n[![Sponsors on Open Collective](https://opencollective.com/html-webpack-plugin/sponsors/badge.svg)](#sponsors)\n\n<div align=\"center\">\n  <img width=\"200\" height=\"200\" src=\"https://www.w3.org/html/logo/downloads/HTML5_Badge.svg\">\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\"\n      src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n  <div>\n    <img width=\"100\" height=\"100\" title=\"Webpack Plugin\" src=\"http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg\">\n  </div>\n  <h1>HTML Webpack Plugin</h1>\n  <p>Plugin that simplifies creation of HTML files to serve your bundles</p>\n</div>\n\n<h2 align=\"center\">Install</h2>\n\n<h3>Webpack 5</h3>\n\n```bash\n  npm i --save-dev html-webpack-plugin\n```\n\n```bash\n  yarn add --dev html-webpack-plugin\n```\n\n<h3>Webpack 4</h3>\n\n```bash\n  npm i --save-dev html-webpack-plugin@4\n```\n\n```bash\n  yarn add --dev html-webpack-plugin@4\n```\n\nThis is a [webpack](http://webpack.js.org/) plugin that simplifies creation of HTML files to serve your `webpack` bundles. This is especially useful for `webpack` bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply\nyour own template using `lodash` templates or use your own loader.\n\n<h2 align=\"center\">Sponsors</h2>\n\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/sponsor/9/avatar.svg\"></a>\n\nThanks for supporting the ongoing improvements to the html-webpack-plugin!\n\n<h2 align=\"center\">Zero Config</h2>\n\nThe `html-webpack-plugin` works without configuration.  \nIt's a great addition to the [⚙️ webpack-config-plugins](https://github.com/namics/webpack-config-plugins/blob/master/README.md#zero-config-webpack-dev-server-example).\n\n<h2 align=\"center\">Plugins</h2>\n\nThe `html-webpack-plugin` provides [hooks](https://github.com/jantimon/html-webpack-plugin#events) to extend it to your needs. There are already some really powerful plugins which can be integrated with zero configuration\n\n- [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity) for enhanced asset security\n- [appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin) for iOS and Android offline usage\n- [favicons-webpack-plugin](https://github.com/jantimon/favicons-webpack-plugin) which generates favicons and icons for iOS, Android and desktop browsers\n- [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin) can be used to always write to disk the html file, useful when webpack-dev-server / HMR are being used\n- [html-webpack-inline-svg-plugin](https://github.com/thegc/html-webpack-inline-svg-plugin) to inline SVGs in the resulting HTML file.\n- [html-webpack-exclude-assets-plugin](https://github.com/jamesjieye/html-webpack-exclude-assets-plugin) for excluding assets using regular expressions\n- [html-webpack-include-assets-plugin](https://github.com/jharris4/html-webpack-include-assets-plugin) for including lists of js or css file paths (such as those copied by the copy-webpack-plugin).\n- [html-webpack-injector](https://github.com/thearchitgarg/html-webpack-injector) to inject chunks in `head` or `body` (different locations ) of same html document.\n- [resource-hints-webpack-plugin](https://github.com/jantimon/resource-hints-webpack-plugin) to add resource hints for faster initial page loads using `<link rel='preload'>` and `<link rel='prefetch'>`\n- [link-media-html-webpack-plugin](https://github.com/yaycmyk/link-media-html-webpack-plugin) allows for injected stylesheet `<link />` tags to have their media attribute set automatically; useful for providing specific desktop/mobile/print etc. stylesheets that the browser will conditionally download\n- [html-webpack-inline-style-plugin](https://github.com/djaax/html-webpack-inline-style-plugin) for inlining styles to HTML elements using [juice](https://github.com/Automattic/juice). Useful for email generation automatisation.\n- [html-webpack-exclude-empty-assets-plugin](https://github.com/KnisterPeter/html-webpack-exclude-empty-assets-plugin) removes empty assets from being added to the html. This fixes some problems with extract-text-plugin with webpack 4.\n- [webpack-concat-plugin](https://github.com/hxlniada/webpack-concat-plugin) for concat and uglify files that needn't to be webpack bundles(for legacy files) and inject to html-webpack-plugin.\n- [html-webpack-link-type-plugin](https://github.com/steadyapp/html-webpack-link-type-plugin) adds a configurable mimetype to resources injected as links (such as adding type=\"text/css\" to external stylesheets) for compatibility with \"strict mode\".\n- [csp-html-webpack-plugin](https://github.com/slackhq/csp-html-webpack-plugin) to add [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) meta tags to the HTML output\n- [strict-csp-html-webpack-plugin](https://github.com/google/strict-csp/tree/main/strict-csp-html-webpack-plugin) to add a [**strict** Content-Security-Policy (CSP)](https://web.dev) as a `meta` tag to the HTML output. A strict CSP is specifically efficient against XSS attacks.\n- [webpack-nomodule-plugin](https://github.com/swimmadude66/webpack-nomodule-plugin) allows you to add a `nomodule` attribute to specific injected scripts, which prevents the scripts from being loaded by newer browsers. Good for limiting loads of polyfills.\n- [html-webpack-skip-assets-plugin](https://github.com/swimmadude66/html-webpack-skip-assets-plugin) Skip adding certain output files to the html file. Built as a drop-in replacement for [html-webpack-exclude-assets-plugin](https://www.npmjs.com/package/html-webpack-exclude-assets-plugin) and works with newer [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) versions\n- [html-webpack-inject-preload](https://github.com/principalstudio/html-webpack-inject-preload) allows to add preload links &lt;link rel='preload'> anywhere you want.\n- [inject-body-webpack-plugin](https://github.com/Jaid/inject-body-webpack-plugin) is a simple method of injecting a custom HTML string into the body.\n- [html-webpack-plugin-django](https://github.com/TommasoAmici/html-webpack-plugin-django) a Webpack plugin to inject Django static tags.\n- [html-webpack-inject-attributes-plugin](https://github.com/dyw934854565/html-webpack-inject-attributes-plugin) add extra attributes to inject assetTags.\n- [js-entry-webpack-plugin](https://github.com/liam61/html-webpack-plugin) creates webpack bundles into your js entry\n\n<h2 align=\"center\">Usage</h2>\n\nThe plugin will generate an HTML5 file for you that includes all your `webpack`\nbundles in the head using `script` tags. Just add the plugin to your `webpack`\nconfig as follows:\n\n**webpack.config.js**\n\n```js\nconst HtmlWebpackPlugin = require(\"html-webpack-plugin\");\n\nmodule.exports = {\n  entry: \"index.js\",\n  output: {\n    path: __dirname + \"/dist\",\n    filename: \"index_bundle.js\",\n  },\n  plugins: [new HtmlWebpackPlugin()],\n};\n```\n\nThis will generate a file `dist/index.html` containing the following\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Webpack App</title>\n    <script defer src=\"index_bundle.js\"></script>\n  </head>\n  <body></body>\n</html>\n```\n\nIf you have multiple `webpack` entry points, they will all be included with `script` tags in the generated HTML.\n\nIf you have any CSS assets in webpack's output (for example, CSS extracted with the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin))\nthen these will be included with `<link>` tags in the HTML head.\n\nIf you have plugins that make use of it, `html-webpack-plugin` should be ordered first before any of the integrated Plugins.\n\n<h2 align=\"center\">Options</h2>\n\nYou can pass a hash of configuration options to `html-webpack-plugin`.\nAllowed values are as follows:\n\n|           Name           |                         Type                         |                        Default                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| :----------------------: | :--------------------------------------------------: | :---------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|       **`title`**        |                      `{String}`                      |                     `Webpack App`                     | The title to use for the generated HTML document                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |\n|      **`filename`**      |                 `{String\\|Function}`                 |                    `'index.html'`                     | The file to write the HTML to. Defaults to `index.html`. You can specify a subdirectory here too (eg: `assets/admin.html`). The `[name]` placeholder will be replaced with the entry name. Can also be a function e.g. `(entryName) => entryName + '.html'`.                                                                                                                                                                                                                                                                               |\n|      **`template`**      |                      `{String}`                      |                          ``                           | `webpack` relative or absolute path to the template. By default it will use `src/index.ejs` if it exists. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details                                                                                                                                                                                                                                                                                                           |\n|  **`templateContent`**   |             `{string\\|Function\\|false}`              |                         false                         | Can be used instead of `template` to provide an inline template - please read the [Writing Your Own Templates](https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates) section                                                                                                                                                                                                                                                                                                                                         |\n| **`templateParameters`** |            `{Boolean\\|Object\\|Function}`             |                        `false`                        | Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters)                                                                                                                                                                                                                                                                                                                                                                          |\n|       **`inject`**       |                 `{Boolean\\|String}`                  |                        `true`                         | `true \\|\\| 'head' \\|\\| 'body' \\|\\| false` Inject all assets into the given `template` or `templateContent`. When passing `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. Passing `true` will add it to the head/body depending on the `scriptLoading` option. Passing `false` will disable automatic injections. - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position) |\n|     **`publicPath`**     |                  `{String\\|'auto'}`                  |                       `'auto'`                        | The publicPath used for script and link tags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n|   **`scriptLoading`**    | `{'blocking'\\|'defer'\\|'module'\\|'systemjs-module'}` |                       `'defer'`                       | Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. Setting to `'module'` adds attribute [`type=\"module\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html). This also implies \"defer\", since modules are automatically deferred.                                                                                                                                                                                          |\n|      **`favicon`**       |                      `{String}`                      |                          ``                           | Adds the given favicon path to the output HTML                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n|        **`meta`**        |                      `{Object}`                      |                         `{}`                          | Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`                                                                                                                                                                                                                                                                                                                                                                                                                             |\n|        **`base`**        |              `{Object\\|String\\|false}`               |                        `false`                        | Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: \"https://example.com/path/page.html`                                                                                                                                                                                                                                                                                                                                                                                                    |\n|       **`minify`**       |                 `{Boolean\\|Object}`                  | `true` if `mode` is `'production'`, otherwise `false` | Controls if and in what ways the output should be minified. See [minification](#minification) below for more details.                                                                                                                                                                                                                                                                                                                                                                                                                      |\n|        **`hash`**        |                     `{Boolean}`                      |                        `false`                        | If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files (i.e. `main.js?hash=compilation_hash`). This is useful for cache busting                                                                                                                                                                                                                                                                                                                                                                   |\n|       **`cache`**        |                     `{Boolean}`                      |                        `true`                         | Emit the file only if it was changed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n|     **`showErrors`**     |                     `{Boolean}`                      |                        `true`                         | Errors details will be written into the HTML page                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n|       **`chunks`**       |                        `{?}`                         |                          `?`                          | Allows you to add only some chunks (e.g only the unit-test chunk)                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n|   **`chunksSortMode`**   |                 `{String\\|Function}`                 |                        `auto`                         | Allows to control how chunks should be sorted before they are included to the HTML. Allowed values are `'none' \\| 'auto' \\| 'manual' \\| {Function}`                                                                                                                                                                                                                                                                                                                                                                                        |\n|   **`excludeChunks`**    |                  `{Array.<string>}`                  |                          ``                           | Allows you to skip some chunks (e.g don't add the unit-test chunk)                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n|       **`xhtml`**        |                     `{Boolean}`                      |                        `false`                        | If `true` render the `link` tags as self-closing (XHTML compliant)                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n\nHere's an example webpack config illustrating how to use these options\n\n**webpack.config.js**\n\n```js\n{\n  entry: 'index.js',\n  output: {\n    path: __dirname + '/dist',\n    filename: 'index_bundle.js'\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      title: 'My App',\n      filename: 'assets/admin.html'\n    })\n  ]\n}\n```\n\n### Generating Multiple HTML Files\n\nTo generate more than one HTML file, declare the plugin more than\nonce in your plugins array\n\n**webpack.config.js**\n\n```js\n{\n  entry: 'index.js',\n  output: {\n    path: __dirname + '/dist',\n    filename: 'index_bundle.js'\n  },\n  plugins: [\n    new HtmlWebpackPlugin(), // Generates default index.html\n    new HtmlWebpackPlugin({  // Also generate a test.html\n      filename: 'test.html',\n      template: 'src/assets/test.html'\n    })\n  ]\n}\n```\n\n### Writing Your Own Templates\n\nIf the default generated HTML doesn't meet your needs you can supply\nyour own template. The easiest way is to use the `template` option and pass a custom HTML file.\nThe html-webpack-plugin will automatically inject all necessary CSS, JS, manifest\nand favicon files into the markup.\n\nDetails of other template loaders are [documented here](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md).\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    title: \"Custom template\",\n    // Load a custom template (lodash by default)\n    template: \"index.html\",\n  }),\n];\n```\n\n**index.html**\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <title><%= htmlWebpackPlugin.options.title %></title>\n  </head>\n  <body></body>\n</html>\n```\n\nIf you already have a template loader, you can use it to parse the template.\nPlease note that this will also happen if you specify the html-loader and use `.html` file as template.\n\n**webpack.config.js**\n\n```js\nmodule: {\n  loaders: [\n    { test: /\\.hbs$/, loader: \"handlebars-loader\" }\n  ]\n},\nplugins: [\n  new HtmlWebpackPlugin({\n    title: 'Custom template using Handlebars',\n    template: 'index.hbs'\n  })\n]\n```\n\nYou can use the `lodash` syntax out of the box. If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/jaketrent/html-webpack-template/blob/86f285d5c790a6c15263f5cc50fd666d51f974fd/index.html) of the [html-webpack-template project](https://github.com/jaketrent/html-webpack-template) as a starting point for writing your own.\n\nThe following variables are available in the template by default (you can extend them using the `templateParameters` option):\n\n- `htmlWebpackPlugin`: data specific to this plugin\n\n  - `htmlWebpackPlugin.options`: the options hash that was passed to\n    the plugin. In addition to the options actually used by this plugin,\n    you can use this hash to pass arbitrary data through to your template.\n\n  - `htmlWebpackPlugin.tags`: the prepared `headTags` and `bodyTags` Array to render the `<base>`, `<meta>`, `<script>` and `<link>` tags.\n    Can be used directly in templates and literals. For example:\n    ```html\n    <html>\n      <head>\n        <%= htmlWebpackPlugin.tags.headTags %>\n      </head>\n      <body>\n        <%= htmlWebpackPlugin.tags.bodyTags %>\n      </body>\n    </html>\n    ```\n  - `htmlWebpackPlugin.files`: direct access to the files used during the compilation.\n\n    ```typescript\n    publicPath: string;\n    js: string[];\n    css: string[];\n    manifest?: string;\n    favicon?: string;\n    ```\n\n- `webpackConfig`: the webpack configuration that was used for this compilation. This\n  can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`).\n\n- `compilation`: the webpack [compilation object](https://webpack.js.org/api/compilation-object/).\n  This can be used, for example, to get the contents of processed assets and inline them\n  directly in the page, through `compilation.assets[...].source()`\n  (see [the inline template example](examples/inline/template.pug)).\n\nThe template can also be directly inlined directly into the options object.  \n⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**\n\n**webpack.config.js**\n\n```js\nnew HtmlWebpackPlugin({\n  templateContent: `\n    <html>\n      <body>\n        <h1>Hello World</h1>\n      </body>\n    </html>\n  `,\n});\n```\n\nThe `templateContent` can also access all `templateParameters` values.  \n⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**\n\n**webpack.config.js**\n\n```js\nnew HtmlWebpackPlugin({\n  inject: false,\n  templateContent: ({ htmlWebpackPlugin }) => `\n    <html>\n      <head>\n        ${htmlWebpackPlugin.tags.headTags}\n      </head>\n      <body>\n        <h1>Hello World</h1>\n        ${htmlWebpackPlugin.tags.bodyTags}\n      </body>\n    </html>\n  `,\n});\n```\n\n### Filtering Chunks\n\nTo include only certain chunks you can limit the chunks being used\n\n**webpack.config.js**\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    chunks: [\"app\"],\n  }),\n];\n```\n\nIt is also possible to exclude certain chunks by setting the `excludeChunks` option\n\n**webpack.config.js**\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    excludeChunks: [\"dev-helper\"],\n  }),\n];\n```\n\n### Minification\n\nIf the `minify` option is set to `true` (the default when webpack's `mode` is `'production'`),\nthe generated HTML will be minified using [html-minifier-terser](https://github.com/DanielRuf/html-minifier-terser)\nand the following options:\n\n```js\n{\n  collapseWhitespace: true,\n  keepClosingSlash: true,\n  removeComments: true,\n  removeRedundantAttributes: true,\n  removeScriptTypeAttributes: true,\n  removeStyleLinkTypeAttributes: true,\n  useShortDoctype: true\n}\n```\n\nTo use custom [html-minifier options](https://github.com/DanielRuf/html-minifier-terser#options-quick-reference)\npass an object to `minify` instead. This object will not be merged with the defaults above.\n\nTo disable minification during production mode set the `minify` option to `false`.\n\n### Meta Tags\n\nIf the `meta` option is set the html-webpack-plugin will inject meta tags.  \nFor the default template the html-webpack-plugin will already provide a default for the `viewport` meta tag.\n\nPlease take a look at this well maintained list of almost all [possible meta tags](https://github.com/joshbuchea/HEAD#meta).\n\n#### name/content meta tags\n\nMost meta tags are configured by setting a `name` and a `content` attribute.  \nTo add those use a key/value pair:\n\n**webpack.config.js**\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    meta: {\n      viewport: \"width=device-width, initial-scale=1, shrink-to-fit=no\",\n      // Will generate: <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n      \"theme-color\": \"#4285f4\",\n      // Will generate: <meta name=\"theme-color\" content=\"#4285f4\">\n    },\n  }),\n];\n```\n\n#### Simulate http response headers\n\nThe **http-equiv** attribute is essentially used to simulate a HTTP response header.  \nThis format is supported using an object notation which allows you to add any attribute:\n\n**webpack.config.js**\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    meta: {\n      \"Content-Security-Policy\": {\n        \"http-equiv\": \"Content-Security-Policy\",\n        content: \"default-src https:\",\n      },\n      // Will generate: <meta http-equiv=\"Content-Security-Policy\" content=\"default-src https:\">\n      // Which equals to the following http header: `Content-Security-Policy: default-src https:`\n      \"set-cookie\": {\n        \"http-equiv\": \"set-cookie\",\n        content: \"name=value; expires=date; path=url\",\n      },\n      // Will generate: <meta http-equiv=\"set-cookie\" content=\"value; expires=date; path=url\">\n      // Which equals to the following http header: `set-cookie: value; expires=date; path=url`\n    },\n  }),\n];\n```\n\n### Base Tag\n\nWhen the `base` option is used,\nhtml-webpack-plugin will inject a [base tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base).\nBy default, a base tag will not be injected.\n\nThe following two are identical and will both insert `<base href=\"http://example.com/some/page.html\">`:\n\n```js\nnew HtmlWebpackPlugin({\n  base: \"http://example.com/some/page.html\",\n});\n```\n\n```js\nnew HtmlWebpackPlugin({\n  base: { href: \"http://example.com/some/page.html\" },\n});\n```\n\nThe `target` can be specified with the corresponding key:\n\n```js\nnew HtmlWebpackPlugin({\n  base: {\n    href: \"http://example.com/some/page.html\",\n    target: \"_blank\",\n  },\n});\n```\n\nwhich will inject the element `<base href=\"http://example.com/some/page.html\" target=\"_blank\">`.\n\n### Long Term Caching\n\nFor long term caching add `contenthash` to the filename.\n\n**Example:**\n\n```js\nplugins: [\n  new HtmlWebpackPlugin({\n    filename: \"index.[contenthash].html\",\n  }),\n];\n```\n\n`contenthash` is the hash of the content of the output file.\n\nRefer webpack's [Template Strings](https://webpack.js.org/configuration/output/#template-strings) for more details\n\n### Events\n\nTo allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the HTML this plugin executes\n[tapable](https://github.com/webpack/tapable/tree/master) hooks.\n\nThe [lib/hooks.js](https://github.com/jantimon/html-webpack-plugin/blob/master/lib/hooks.js) contains all information\nabout which values are passed.\n\n[![Concept flow uml](https://raw.githubusercontent.com/jantimon/html-webpack-plugin/master/flow.png)](https://github.com/jantimon/html-webpack-plugin/blob/master/flow.puml)\n\n#### `beforeAssetTagGeneration` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      assets: {\n        publicPath: string,\n        js: Array<{string}>,\n        css: Array<{string}>,\n        favicon?: string | undefined,\n        manifest?: string | undefined\n      },\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n```\n\n#### `alterAssetTags` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      assetTags: {\n        scripts: Array<HtmlTagObject>,\n        styles: Array<HtmlTagObject>,\n        meta: Array<HtmlTagObject>,\n      },\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n```\n\n#### `alterAssetTagGroups` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n```\n\n#### `afterTemplateExecution` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      html: string,\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>\n```\n\n#### `beforeEmit` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      html: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>\n```\n\n#### `afterEmit` hook\n\n```\n    AsyncSeriesWaterfallHook<{\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n```\n\nExample implementation: [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity)\n\n**plugin.js**\n\n```js\n// If your plugin is direct dependent to the html webpack plugin:\nconst HtmlWebpackPlugin = require(\"html-webpack-plugin\");\n// If your plugin is using html-webpack-plugin as an optional dependency\n// you can use https://github.com/tallesl/node-safe-require instead:\nconst HtmlWebpackPlugin = require(\"safe-require\")(\"html-webpack-plugin\");\n\nclass MyPlugin {\n  apply(compiler) {\n    compiler.hooks.compilation.tap(\"MyPlugin\", (compilation) => {\n      console.log(\"The compiler is starting a new compilation...\");\n\n      // Static Plugin interface |compilation |HOOK NAME | register listener\n      HtmlWebpackPlugin.getCompilationHooks(compilation).beforeEmit.tapAsync(\n        \"MyPlugin\", // <-- Set a meaningful name here for stacktraces\n        (data, cb) => {\n          // Manipulate the content\n          data.html += \"The Magic Footer\";\n          // Tell webpack to move on\n          cb(null, data);\n        },\n      );\n    });\n  }\n}\n\nmodule.exports = MyPlugin;\n```\n\n**webpack.config.js**\n\n```js\nplugins: [new MyPlugin({ options: \"\" })];\n```\n\nNote that the callback must be passed the HtmlWebpackPluginData in order to pass this onto any other plugins listening on the same `beforeEmit` event\n\n<h2 align=\"center\">Maintainers</h2>\n\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\">\n        <img width=\"150\" height=\"150\"\n        src=\"https://avatars3.githubusercontent.com/u/4113649?v=3&s=150\">\n        </br>\n        <a href=\"https://github.com/jantimon\">Jan Nicklas</a>\n      </td>\n      <td align=\"center\">\n        <img width=\"150\" height=\"150\"\n        src=\"https://avatars2.githubusercontent.com/u/4112409?v=3&s=150\">\n        </br>\n        <a href=\"https://github.com/mastilver\">Thomas Sileghem</a>\n      </td>\n    </tr>\n  <tbody>\n</table>\n\n## Backers\n\nThank you to all our backers!  \nIf you want to support the project as well [become a sponsor](https://opencollective.com/html-webpack-plugin#sponsor) or a [a backer](https://opencollective.com/html-webpack-plugin#backer).\n\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/0/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/0/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/1/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/1/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/2/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/2/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/3/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/3/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/4/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/4/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/5/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/5/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/6/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/6/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/7/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/7/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/8/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/8/avatar.svg?requireActive=false\"></a>\n<a href=\"https://opencollective.com/html-webpack-plugin/backer/9/website?requireActive=false\" target=\"_blank\"><img src=\"https://opencollective.com/html-webpack-plugin/backer/9/avatar.svg?requireActive=false\"></a>\n\n## Contributors\n\nThis project exists thanks to all the people who contribute.\n\nYou're free to contribute to this project by submitting [issues](https://github.com/jantimon/html-webpack-plugin/issues) and/or [pull requests](https://github.com/jantimon/html-webpack-plugin/pulls). This project is test-driven, so keep in mind that every change and new feature should be covered by tests.\n\n<a href=\"https://github.com/jantimon/html-webpack-plugin/graphs/contributors\"><img src=\"https://opencollective.com/html-webpack-plugin/contributors.svg?width=890&button=false\" /></a>\n\n[npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg\n[npm-url]: https://npmjs.com/package/html-webpack-plugin\n[node]: https://img.shields.io/node/v/html-webpack-plugin.svg\n[node-url]: https://nodejs.org\n[tests]: https://github.com/jantimon/html-webpack-plugin/workflows/CI/badge.svg\n[tests-url]: https://github.com/jantimon/html-webpack-plugin/actions?query=workflow%3ACI\n"
  },
  {
    "path": "commitlint.config.js",
    "content": "module.exports = {\n  extends: [\"@commitlint/config-conventional\"],\n  rules: {\n    \"header-max-length\": [0],\n    \"body-max-line-length\": [0],\n    \"footer-max-line-length\": [0],\n  },\n};\n"
  },
  {
    "path": "default_index.ejs",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title><%= htmlWebpackPlugin.options.title %></title>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "docs/template-option.md",
    "content": "# The template option\n\n## History\n\nThe version 2.x which was introduced 2015 changed the way the template is processed.\nInstead of forcing all users to use the [blueimp](https://github.com/blueimp/JavaScript-Templates) template engine it allowed to use any webpack loader:\n\n- [pug](https://github.com/pugjs/pug-loader)\n- [ejs](https://github.com/okonet/ejs-loader)\n- [underscore](https://github.com/emaphp/underscore-template-loader)\n- [handlebars](https://github.com/pcardune/handlebars-loader)\n- [html-loader](https://github.com/webpack/html-loader)\n- ...\n\nUnder the hood it is using a webpack child compilation which inherits all loaders from\nyour main configuration.\n\nThere are three ways to set the loader:\n\n## 1) Don't set any loader\n\nBy default (if you don't specify any loader in any way) a [fallback ejs loader](https://github.com/jantimon/html-webpack-plugin/blob/master/lib/loader.js) kicks in.\nPlease note that this loader does not support the full ejs syntax as it is based on [lodash template](https://lodash.com/docs/#template).\n\n```js\n{\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"src/index.html\",\n    }),\n  ];\n}\n```\n\nBe aware, using `.html` as your template extension may unexpectedly trigger another loader.\n\n## 2) Setting a loader directly for the template\n\n```js\nnew HtmlWebpackPlugin({\n  // For details on `!!` see https://webpack.js.org/concepts/loaders/#inline\n  template: \"!!handlebars-loader!src/index.hbs\",\n});\n```\n\n## 3) Setting a loader using the `module.rules` syntax\n\n```js\n{\n  module: {\n    rules: [\n      {\n        test: /\\.hbs$/,\n        loader: 'handlebars-loader'\n      },\n    ]\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: 'src/index.hbs'\n    })\n  ]\n}\n```\n\nHowever this also means that in the following example webpack will use the [html loader for your template](https://webpack.js.org/loaders/html-loader/).\nThis will **cause html minification** and it will also **disable the ejs/lodash fallback** loader.\n\n```js\n{\n  module: {\n    rules: [\n      {\n        test: /\\.html$/,\n        loader: 'html-loader'\n      }],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: 'src/index.html'\n    })\n  ]\n}\n```\n"
  },
  {
    "path": "examples/README.md",
    "content": "# Examples\n\nA collection of repositories or pages using html-webpack-plugin.\n\n| Example                           | Link                                                  |\n| --------------------------------- | ----------------------------------------------------- |\n| Appcache                          | [appcache](./appcache)                                |\n| Chunk Optimization                | [chunk-optimization](./chunk-optimization)            |\n| Custom Template                   | [custom-template](./custom-template)                  |\n| Custom Script / Link tag position | [custom-insertion-point](./custom-insertion-position) |\n| Default                           | [default](./default)                                  |\n| Favicon                           | [favicon](./favicon.)                                 |\n| Html Loader                       | [html-loader](./html-loader)                          |\n| Inline                            | [inline](./inline)                                    |\n| Javascript-advanced               | [javascript-advanced](./javascript-advanced)          |\n| Javascript                        | [javascript](./javascript)                            |\n| Pug Loader                        | [pug-loader](./pug-loader)                            |\n| Sort Manually                     | [sort-manually](./sort-manually)                      |\n| Template Parameters               | [template-parameters](./template-parameters)          |\n"
  },
  {
    "path": "examples/build-examples.js",
    "content": "/**\n * This file is just a helper to compile all examples.\n *\n * You could do the same by going into each example and execute\n * `webpack`\n */\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nvar fs = require(\"fs\");\nvar path = require(\"path\");\nvar rimraf = require(\"rimraf\");\nvar webpack = require(\"webpack\");\n\nvar examples = fs.readdirSync(__dirname).filter(function (file) {\n  return fs.statSync(path.join(__dirname, file)).isDirectory();\n});\n\nexamples.forEach(function (exampleName) {\n  var examplePath = path.join(__dirname, exampleName);\n  var configFile = path.join(examplePath, \"webpack.config.js\");\n\n  var config = require(configFile);\n  if (Number(webpackMajorVersion) >= 4) {\n    config.plugins.unshift(\n      new webpack.LoaderOptionsPlugin({\n        options: {\n          context: process.cwd(), // or the same value as `context`\n        },\n      }),\n    );\n    config.mode = \"production\";\n    config.optimization = config.optimization || {};\n    config.optimization.minimizer = [];\n  }\n\n  rimraf.sync(path.join(examplePath, \"dist\", \"webpack-\" + webpackMajorVersion));\n  webpack(config, function (err, stats) {\n    if (err) {\n      console.error(err.stack || err);\n      if (err.details) {\n        console.error(err.details);\n      }\n      return;\n    }\n\n    const info = stats.toJson();\n\n    if (stats.hasErrors()) {\n      console.error(info.errors);\n    }\n\n    if (stats.hasWarnings()) {\n      console.warn(info.warnings);\n    }\n  });\n});\n"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/192.js",
    "content": "\"use strict\";\n(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[192],{\n\n/***/ 192\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);\n\n            \n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A, options);\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A.locals || {});\n\n/***/ },\n\n/***/ 810\n(module, __webpack_exports__, __webpack_require__) {\n\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   A: () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body {\\n  background: snow;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n/***/ }\n\n}]);"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/461.js",
    "content": "\"use strict\";\n(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[461],{\n\n/***/ 591\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n\nvar isOldIE = function isOldIE() {\n  var memo;\n  return function memorize() {\n    if (typeof memo === 'undefined') {\n      // Test for IE <= 9 as proposed by Browserhacks\n      // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n      // Tests for existence of standard globals is to allow style-loader\n      // to operate correctly into non-standard environments\n      // @see https://github.com/webpack-contrib/style-loader/issues/177\n      memo = Boolean(window && document && document.all && !window.atob);\n    }\n\n    return memo;\n  };\n}();\n\nvar getTarget = function getTarget() {\n  var memo = {};\n  return function memorize(target) {\n    if (typeof memo[target] === 'undefined') {\n      var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n      if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n        try {\n          // This will throw an exception if access to iframe is blocked\n          // due to cross-origin restrictions\n          styleTarget = styleTarget.contentDocument.head;\n        } catch (e) {\n          // istanbul ignore next\n          styleTarget = null;\n        }\n      }\n\n      memo[target] = styleTarget;\n    }\n\n    return memo[target];\n  };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n  var result = -1;\n\n  for (var i = 0; i < stylesInDom.length; i++) {\n    if (stylesInDom[i].identifier === identifier) {\n      result = i;\n      break;\n    }\n  }\n\n  return result;\n}\n\nfunction modulesToDom(list, options) {\n  var idCountMap = {};\n  var identifiers = [];\n\n  for (var i = 0; i < list.length; i++) {\n    var item = list[i];\n    var id = options.base ? item[0] + options.base : item[0];\n    var count = idCountMap[id] || 0;\n    var identifier = \"\".concat(id, \" \").concat(count);\n    idCountMap[id] = count + 1;\n    var index = getIndexByIdentifier(identifier);\n    var obj = {\n      css: item[1],\n      media: item[2],\n      sourceMap: item[3]\n    };\n\n    if (index !== -1) {\n      stylesInDom[index].references++;\n      stylesInDom[index].updater(obj);\n    } else {\n      stylesInDom.push({\n        identifier: identifier,\n        updater: addStyle(obj, options),\n        references: 1\n      });\n    }\n\n    identifiers.push(identifier);\n  }\n\n  return identifiers;\n}\n\nfunction insertStyleElement(options) {\n  var style = document.createElement('style');\n  var attributes = options.attributes || {};\n\n  if (typeof attributes.nonce === 'undefined') {\n    var nonce =  true ? __webpack_require__.nc : 0;\n\n    if (nonce) {\n      attributes.nonce = nonce;\n    }\n  }\n\n  Object.keys(attributes).forEach(function (key) {\n    style.setAttribute(key, attributes[key]);\n  });\n\n  if (typeof options.insert === 'function') {\n    options.insert(style);\n  } else {\n    var target = getTarget(options.insert || 'head');\n\n    if (!target) {\n      throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n    }\n\n    target.appendChild(style);\n  }\n\n  return style;\n}\n\nfunction removeStyleElement(style) {\n  // istanbul ignore if\n  if (style.parentNode === null) {\n    return false;\n  }\n\n  style.parentNode.removeChild(style);\n}\n/* istanbul ignore next  */\n\n\nvar replaceText = function replaceText() {\n  var textStore = [];\n  return function replace(index, replacement) {\n    textStore[index] = replacement;\n    return textStore.filter(Boolean).join('\\n');\n  };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n  var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n  /* istanbul ignore if  */\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = replaceText(index, css);\n  } else {\n    var cssNode = document.createTextNode(css);\n    var childNodes = style.childNodes;\n\n    if (childNodes[index]) {\n      style.removeChild(childNodes[index]);\n    }\n\n    if (childNodes.length) {\n      style.insertBefore(cssNode, childNodes[index]);\n    } else {\n      style.appendChild(cssNode);\n    }\n  }\n}\n\nfunction applyToTag(style, options, obj) {\n  var css = obj.css;\n  var media = obj.media;\n  var sourceMap = obj.sourceMap;\n\n  if (media) {\n    style.setAttribute('media', media);\n  } else {\n    style.removeAttribute('media');\n  }\n\n  if (sourceMap && typeof btoa !== 'undefined') {\n    css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n  } // For old IE\n\n  /* istanbul ignore if  */\n\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    while (style.firstChild) {\n      style.removeChild(style.firstChild);\n    }\n\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n  var style;\n  var update;\n  var remove;\n\n  if (options.singleton) {\n    var styleIndex = singletonCounter++;\n    style = singleton || (singleton = insertStyleElement(options));\n    update = applyToSingletonTag.bind(null, style, styleIndex, false);\n    remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n  } else {\n    style = insertStyleElement(options);\n    update = applyToTag.bind(null, style, options);\n\n    remove = function remove() {\n      removeStyleElement(style);\n    };\n  }\n\n  update(obj);\n  return function updateStyle(newObj) {\n    if (newObj) {\n      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n        return;\n      }\n\n      update(obj = newObj);\n    } else {\n      remove();\n    }\n  };\n}\n\nmodule.exports = function (list, options) {\n  options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n  // tags it will allow on a page\n\n  if (!options.singleton && typeof options.singleton !== 'boolean') {\n    options.singleton = isOldIE();\n  }\n\n  list = list || [];\n  var lastIdentifiers = modulesToDom(list, options);\n  return function update(newList) {\n    newList = newList || [];\n\n    if (Object.prototype.toString.call(newList) !== '[object Array]') {\n      return;\n    }\n\n    for (var i = 0; i < lastIdentifiers.length; i++) {\n      var identifier = lastIdentifiers[i];\n      var index = getIndexByIdentifier(identifier);\n      stylesInDom[index].references--;\n    }\n\n    var newLastIdentifiers = modulesToDom(newList, options);\n\n    for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n      var _identifier = lastIdentifiers[_i];\n\n      var _index = getIndexByIdentifier(_identifier);\n\n      if (stylesInDom[_index].references === 0) {\n        stylesInDom[_index].updater();\n\n        stylesInDom.splice(_index, 1);\n      }\n    }\n\n    lastIdentifiers = newLastIdentifiers;\n  };\n};\n\n/***/ },\n\n/***/ 935\n(module) {\n\n\n\n/*\n  MIT License http://www.opensource.org/licenses/mit-license.php\n  Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n  var list = []; // return the list of modules as css string\n\n  list.toString = function toString() {\n    return this.map(function (item) {\n      var content = cssWithMappingToString(item);\n\n      if (item[2]) {\n        return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n      }\n\n      return content;\n    }).join('');\n  }; // import a list of modules into the list\n  // eslint-disable-next-line func-names\n\n\n  list.i = function (modules, mediaQuery, dedupe) {\n    if (typeof modules === 'string') {\n      // eslint-disable-next-line no-param-reassign\n      modules = [[null, modules, '']];\n    }\n\n    var alreadyImportedModules = {};\n\n    if (dedupe) {\n      for (var i = 0; i < this.length; i++) {\n        // eslint-disable-next-line prefer-destructuring\n        var id = this[i][0];\n\n        if (id != null) {\n          alreadyImportedModules[id] = true;\n        }\n      }\n    }\n\n    for (var _i = 0; _i < modules.length; _i++) {\n      var item = [].concat(modules[_i]);\n\n      if (dedupe && alreadyImportedModules[item[0]]) {\n        // eslint-disable-next-line no-continue\n        continue;\n      }\n\n      if (mediaQuery) {\n        if (!item[2]) {\n          item[2] = mediaQuery;\n        } else {\n          item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n        }\n      }\n\n      list.push(item);\n    }\n  };\n\n  return list;\n};\n\n/***/ }\n\n}]);"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/entryA.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"libMath.js\"></script><script defer=\"defer\" src=\"libText.js\"></script><script defer=\"defer\" src=\"461.js\"></script><script defer=\"defer\" src=\"192.js\"></script><script defer=\"defer\" src=\"entryA.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/entryA.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 910\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n__webpack_require__(192);\nvar multiply = __webpack_require__(199);\nvar concat = __webpack_require__(631);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = concat(\"Hello world from Entry \", multiply(1, 1));\ndocument.body.appendChild(h1);\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = __webpack_modules__;\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/chunk loaded */\n/******/ \t(() => {\n/******/ \t\tvar deferred = [];\n/******/ \t\t__webpack_require__.O = (result, chunkIds, fn, priority) => {\n/******/ \t\t\tif(chunkIds) {\n/******/ \t\t\t\tpriority = priority || 0;\n/******/ \t\t\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n/******/ \t\t\t\tdeferred[i] = [chunkIds, fn, priority];\n/******/ \t\t\t\treturn;\n/******/ \t\t\t}\n/******/ \t\t\tvar notFulfilled = Infinity;\n/******/ \t\t\tfor (var i = 0; i < deferred.length; i++) {\n/******/ \t\t\t\tvar [chunkIds, fn, priority] = deferred[i];\n/******/ \t\t\t\tvar fulfilled = true;\n/******/ \t\t\t\tfor (var j = 0; j < chunkIds.length; j++) {\n/******/ \t\t\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n/******/ \t\t\t\t\t\tchunkIds.splice(j--, 1);\n/******/ \t\t\t\t\t} else {\n/******/ \t\t\t\t\t\tfulfilled = false;\n/******/ \t\t\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n/******/ \t\t\t\t\t}\n/******/ \t\t\t\t}\n/******/ \t\t\t\tif(fulfilled) {\n/******/ \t\t\t\t\tdeferred.splice(i--, 1)\n/******/ \t\t\t\t\tvar r = fn();\n/******/ \t\t\t\t\tif (r !== undefined) result = r;\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t\treturn result;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t(() => {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = (module) => {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\t() => (module['default']) :\n/******/ \t\t\t\t() => (module);\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/jsonp chunk loading */\n/******/ \t(() => {\n/******/ \t\t// no baseURI\n/******/ \t\t\n/******/ \t\t// object to store loaded and loading chunks\n/******/ \t\t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n/******/ \t\t// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\n/******/ \t\tvar installedChunks = {\n/******/ \t\t\t570: 0\n/******/ \t\t};\n/******/ \t\t\n/******/ \t\t// no chunk on demand loading\n/******/ \t\t\n/******/ \t\t// no prefetching\n/******/ \t\t\n/******/ \t\t// no preloaded\n/******/ \t\t\n/******/ \t\t// no HMR\n/******/ \t\t\n/******/ \t\t// no HMR manifest\n/******/ \t\t\n/******/ \t\t__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n/******/ \t\t\n/******/ \t\t// install a JSONP callback for chunk loading\n/******/ \t\tvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n/******/ \t\t\tvar [chunkIds, moreModules, runtime] = data;\n/******/ \t\t\t// add \"moreModules\" to the modules object,\n/******/ \t\t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\t\tvar moduleId, chunkId, i = 0;\n/******/ \t\t\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n/******/ \t\t\t\tfor(moduleId in moreModules) {\n/******/ \t\t\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n/******/ \t\t\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n/******/ \t\t\t\t\t}\n/******/ \t\t\t\t}\n/******/ \t\t\t\tif(runtime) var result = runtime(__webpack_require__);\n/******/ \t\t\t}\n/******/ \t\t\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n/******/ \t\t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\t\tchunkId = chunkIds[i];\n/******/ \t\t\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n/******/ \t\t\t\t\tinstalledChunks[chunkId][0]();\n/******/ \t\t\t\t}\n/******/ \t\t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t\t}\n/******/ \t\t\treturn __webpack_require__.O(result);\n/******/ \t\t}\n/******/ \t\t\n/******/ \t\tvar chunkLoadingGlobal = self[\"webpackChunk\"] = self[\"webpackChunk\"] || [];\n/******/ \t\tchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\n/******/ \t\tchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/nonce */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.nc = undefined;\n/******/ \t})();\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module depends on other loaded chunks and execution need to be delayed\n/******/ \tvar __webpack_exports__ = __webpack_require__.O(undefined, [646,209,461,192], () => (__webpack_require__(910)))\n/******/ \t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n/******/ \t\n/******/ })()\n;"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/entryB.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"libMath.js\"></script><script defer=\"defer\" src=\"461.js\"></script><script defer=\"defer\" src=\"192.js\"></script><script defer=\"defer\" src=\"entryB.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/entryB.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 123\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n__webpack_require__(192);\nvar multiply = __webpack_require__(199);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world from Entry \" + multiply(1, 2);\ndocument.body.appendChild(h1);\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = __webpack_modules__;\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/chunk loaded */\n/******/ \t(() => {\n/******/ \t\tvar deferred = [];\n/******/ \t\t__webpack_require__.O = (result, chunkIds, fn, priority) => {\n/******/ \t\t\tif(chunkIds) {\n/******/ \t\t\t\tpriority = priority || 0;\n/******/ \t\t\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n/******/ \t\t\t\tdeferred[i] = [chunkIds, fn, priority];\n/******/ \t\t\t\treturn;\n/******/ \t\t\t}\n/******/ \t\t\tvar notFulfilled = Infinity;\n/******/ \t\t\tfor (var i = 0; i < deferred.length; i++) {\n/******/ \t\t\t\tvar [chunkIds, fn, priority] = deferred[i];\n/******/ \t\t\t\tvar fulfilled = true;\n/******/ \t\t\t\tfor (var j = 0; j < chunkIds.length; j++) {\n/******/ \t\t\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n/******/ \t\t\t\t\t\tchunkIds.splice(j--, 1);\n/******/ \t\t\t\t\t} else {\n/******/ \t\t\t\t\t\tfulfilled = false;\n/******/ \t\t\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n/******/ \t\t\t\t\t}\n/******/ \t\t\t\t}\n/******/ \t\t\t\tif(fulfilled) {\n/******/ \t\t\t\t\tdeferred.splice(i--, 1)\n/******/ \t\t\t\t\tvar r = fn();\n/******/ \t\t\t\t\tif (r !== undefined) result = r;\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t\treturn result;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t(() => {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = (module) => {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\t() => (module['default']) :\n/******/ \t\t\t\t() => (module);\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/jsonp chunk loading */\n/******/ \t(() => {\n/******/ \t\t// no baseURI\n/******/ \t\t\n/******/ \t\t// object to store loaded and loading chunks\n/******/ \t\t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n/******/ \t\t// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\n/******/ \t\tvar installedChunks = {\n/******/ \t\t\t761: 0\n/******/ \t\t};\n/******/ \t\t\n/******/ \t\t// no chunk on demand loading\n/******/ \t\t\n/******/ \t\t// no prefetching\n/******/ \t\t\n/******/ \t\t// no preloaded\n/******/ \t\t\n/******/ \t\t// no HMR\n/******/ \t\t\n/******/ \t\t// no HMR manifest\n/******/ \t\t\n/******/ \t\t__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n/******/ \t\t\n/******/ \t\t// install a JSONP callback for chunk loading\n/******/ \t\tvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n/******/ \t\t\tvar [chunkIds, moreModules, runtime] = data;\n/******/ \t\t\t// add \"moreModules\" to the modules object,\n/******/ \t\t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\t\tvar moduleId, chunkId, i = 0;\n/******/ \t\t\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n/******/ \t\t\t\tfor(moduleId in moreModules) {\n/******/ \t\t\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n/******/ \t\t\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n/******/ \t\t\t\t\t}\n/******/ \t\t\t\t}\n/******/ \t\t\t\tif(runtime) var result = runtime(__webpack_require__);\n/******/ \t\t\t}\n/******/ \t\t\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n/******/ \t\t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\t\tchunkId = chunkIds[i];\n/******/ \t\t\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n/******/ \t\t\t\t\tinstalledChunks[chunkId][0]();\n/******/ \t\t\t\t}\n/******/ \t\t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t\t}\n/******/ \t\t\treturn __webpack_require__.O(result);\n/******/ \t\t}\n/******/ \t\t\n/******/ \t\tvar chunkLoadingGlobal = self[\"webpackChunk\"] = self[\"webpackChunk\"] || [];\n/******/ \t\tchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\n/******/ \t\tchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/nonce */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.nc = undefined;\n/******/ \t})();\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module depends on other loaded chunks and execution need to be delayed\n/******/ \tvar __webpack_exports__ = __webpack_require__.O(undefined, [646,461,192], () => (__webpack_require__(123)))\n/******/ \t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n/******/ \t\n/******/ })()\n;"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/entryC.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"libMath.js\"></script><script defer=\"defer\" src=\"libText.js\"></script><script defer=\"defer\" src=\"461.js\"></script><script defer=\"defer\" src=\"192.js\"></script><script defer=\"defer\" src=\"entryA.js\"></script><script defer=\"defer\" src=\"entryB.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/libMath.js",
    "content": "(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[646],{\n\n/***/ 16\n(module) {\n\nmodule.exports = function sum(a, b) {\n  return a + b;\n};\n\n\n/***/ },\n\n/***/ 199\n(module, __unused_webpack_exports, __webpack_require__) {\n\nvar sum = __webpack_require__(16);\nmodule.exports = function multiply(a, b) {\n  var m = 0;\n  for (var i = 0; i < a; i = sum(i, 1)) {\n    m = sum(m, b);\n  }\n  return m;\n};\n\n\n/***/ }\n\n}]);"
  },
  {
    "path": "examples/chunk-optimization/dist/webpack-5/libText.js",
    "content": "(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[209],{\n\n/***/ 631\n(module) {\n\nmodule.exports = function concat(a, b) {\n  return String(a) + String(b);\n};\n\n\n/***/ }\n\n}]);"
  },
  {
    "path": "examples/chunk-optimization/entryA.js",
    "content": "require(\"./main.css\");\nvar multiply = require(\"./lib-multiply.js\");\nvar concat = require(\"./lib-concat.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = concat(\"Hello world from Entry \", multiply(1, 1));\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/chunk-optimization/entryB.js",
    "content": "require(\"./main.css\");\nvar multiply = require(\"./lib-multiply.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world from Entry \" + multiply(1, 2);\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/chunk-optimization/lib-concat.js",
    "content": "module.exports = function concat(a, b) {\n  return String(a) + String(b);\n};\n"
  },
  {
    "path": "examples/chunk-optimization/lib-multiply.js",
    "content": "var sum = require(\"./lib-sum.js\");\nmodule.exports = function multiply(a, b) {\n  var m = 0;\n  for (var i = 0; i < a; i = sum(i, 1)) {\n    m = sum(m, b);\n  }\n  return m;\n};\n"
  },
  {
    "path": "examples/chunk-optimization/lib-sum.js",
    "content": "module.exports = function sum(a, b) {\n  return a + b;\n};\n"
  },
  {
    "path": "examples/chunk-optimization/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/chunk-optimization/readme.md",
    "content": "# zero-config example\n\nin this example only the default configuration is used\n"
  },
  {
    "path": "examples/chunk-optimization/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: {\n    entryA: \"./entryA.js\",\n    entryB: \"./entryB.js\",\n  },\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"[name].js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [\"style-loader\", \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n    ],\n  },\n  optimization: {\n    splitChunks: {\n      chunks: \"all\",\n      minSize: 0,\n      maxAsyncRequests: 9,\n      maxInitialRequests: 9,\n      name: false,\n      cacheGroups: {\n        libMath: {\n          test: /lib-(multiply|sum)/,\n          name: \"libMath\",\n          chunks: \"all\",\n        },\n        libText: {\n          test: /lib-concat/,\n          name: \"libText\",\n          chunks: \"all\",\n        },\n      },\n    },\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: \"entryA.html\",\n      chunks: [\"entryA\"],\n    }),\n    new HtmlWebpackPlugin({\n      filename: \"entryB.html\",\n      chunks: [\"entryB\"],\n    }),\n    new HtmlWebpackPlugin({\n      filename: \"entryC.html\",\n    }),\n  ],\n};\n"
  },
  {
    "path": "examples/custom-insertion-position/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/custom-insertion-position/dist/webpack-5/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script defer src=\"bundle.js\"></script>\n    <title>Custom insertion example</title>\n  </head>\n  <body>\n    All scripts are placed here:\n    \n    <script>console.log(\"Executed after all other scripts\")</script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/custom-insertion-position/example.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/custom-insertion-position/index.ejs",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <%= htmlWebpackPlugin.tags.headTags %>\n    <title>Custom insertion example</title>\n  </head>\n  <body>\n    All scripts are placed here:\n    <%= htmlWebpackPlugin.tags.bodyTags %>\n    <script>console.log(\"Executed after all other scripts\")</script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/custom-insertion-position/readme.md",
    "content": "# custom insertion example\n\nThis example shows how you can define the position where the scripts are injected\nby setting `inject:false` and using the template parameters inside the `index.ejs`\n\nThe example is using the template parameters `headTags` and `bodyTags`\n\n```\n<%= htmlWebpackPlugin.tags.headTags %>\n<%= htmlWebpackPlugin.tags.bodyTags %>\n```\n\n`headTags` and `bodyTags` are arrays so you can use any Array.prototype function like `filter`:\n\n```\n<%= htmlWebpackPlugin\n  .tags\n  .headTags\n  .filter((tag) => tag.tagName === 'meta')\n  .join('')\n%>\n```\n\nFor further information about the tag object take a look at the `createHtmlTagObject` inside `lib/html-tags.js` or at the `prepareAssetTagGroupForRendering` inside `index.js`.\n"
  },
  {
    "path": "examples/custom-insertion-position/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"index.ejs\",\n      inject: false,\n      // The following settings are optional and only used for\n      // demo purposes:\n      meta: {\n        charset: { charset: \"utf-8\" },\n        viewport: \"width=device-width, initial-scale=1\",\n      },\n      minify: false,\n    }),\n  ],\n};\n"
  },
  {
    "path": "examples/custom-template/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(969);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/custom-template/dist/webpack-5/index.html",
    "content": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><h2>Partial</h2><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/custom-template/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/custom-template/example.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/custom-template/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/custom-template/partial.html",
    "content": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
  },
  {
    "path": "examples/custom-template/readme.md",
    "content": "# custom template\n\nThis example uses a custom underscore template which inlines an partial using the html-loader:\n`<%= require('html-loader!./partial.html').default %>`\n"
  },
  {
    "path": "examples/custom-template/template.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title><%= htmlWebpackPlugin.options.title %></title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  </head>\n  <body>\n    <%= require('html-loader!./partial.html').default %>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/custom-template/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.html\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/default/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);\n\n            \n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A, options);\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A.locals || {});\n\n/***/ },\n\n/***/ 591\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isOldIE = function isOldIE() {\n  var memo;\n  return function memorize() {\n    if (typeof memo === 'undefined') {\n      // Test for IE <= 9 as proposed by Browserhacks\n      // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n      // Tests for existence of standard globals is to allow style-loader\n      // to operate correctly into non-standard environments\n      // @see https://github.com/webpack-contrib/style-loader/issues/177\n      memo = Boolean(window && document && document.all && !window.atob);\n    }\n\n    return memo;\n  };\n}();\n\nvar getTarget = function getTarget() {\n  var memo = {};\n  return function memorize(target) {\n    if (typeof memo[target] === 'undefined') {\n      var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n      if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n        try {\n          // This will throw an exception if access to iframe is blocked\n          // due to cross-origin restrictions\n          styleTarget = styleTarget.contentDocument.head;\n        } catch (e) {\n          // istanbul ignore next\n          styleTarget = null;\n        }\n      }\n\n      memo[target] = styleTarget;\n    }\n\n    return memo[target];\n  };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n  var result = -1;\n\n  for (var i = 0; i < stylesInDom.length; i++) {\n    if (stylesInDom[i].identifier === identifier) {\n      result = i;\n      break;\n    }\n  }\n\n  return result;\n}\n\nfunction modulesToDom(list, options) {\n  var idCountMap = {};\n  var identifiers = [];\n\n  for (var i = 0; i < list.length; i++) {\n    var item = list[i];\n    var id = options.base ? item[0] + options.base : item[0];\n    var count = idCountMap[id] || 0;\n    var identifier = \"\".concat(id, \" \").concat(count);\n    idCountMap[id] = count + 1;\n    var index = getIndexByIdentifier(identifier);\n    var obj = {\n      css: item[1],\n      media: item[2],\n      sourceMap: item[3]\n    };\n\n    if (index !== -1) {\n      stylesInDom[index].references++;\n      stylesInDom[index].updater(obj);\n    } else {\n      stylesInDom.push({\n        identifier: identifier,\n        updater: addStyle(obj, options),\n        references: 1\n      });\n    }\n\n    identifiers.push(identifier);\n  }\n\n  return identifiers;\n}\n\nfunction insertStyleElement(options) {\n  var style = document.createElement('style');\n  var attributes = options.attributes || {};\n\n  if (typeof attributes.nonce === 'undefined') {\n    var nonce =  true ? __webpack_require__.nc : 0;\n\n    if (nonce) {\n      attributes.nonce = nonce;\n    }\n  }\n\n  Object.keys(attributes).forEach(function (key) {\n    style.setAttribute(key, attributes[key]);\n  });\n\n  if (typeof options.insert === 'function') {\n    options.insert(style);\n  } else {\n    var target = getTarget(options.insert || 'head');\n\n    if (!target) {\n      throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n    }\n\n    target.appendChild(style);\n  }\n\n  return style;\n}\n\nfunction removeStyleElement(style) {\n  // istanbul ignore if\n  if (style.parentNode === null) {\n    return false;\n  }\n\n  style.parentNode.removeChild(style);\n}\n/* istanbul ignore next  */\n\n\nvar replaceText = function replaceText() {\n  var textStore = [];\n  return function replace(index, replacement) {\n    textStore[index] = replacement;\n    return textStore.filter(Boolean).join('\\n');\n  };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n  var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n  /* istanbul ignore if  */\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = replaceText(index, css);\n  } else {\n    var cssNode = document.createTextNode(css);\n    var childNodes = style.childNodes;\n\n    if (childNodes[index]) {\n      style.removeChild(childNodes[index]);\n    }\n\n    if (childNodes.length) {\n      style.insertBefore(cssNode, childNodes[index]);\n    } else {\n      style.appendChild(cssNode);\n    }\n  }\n}\n\nfunction applyToTag(style, options, obj) {\n  var css = obj.css;\n  var media = obj.media;\n  var sourceMap = obj.sourceMap;\n\n  if (media) {\n    style.setAttribute('media', media);\n  } else {\n    style.removeAttribute('media');\n  }\n\n  if (sourceMap && typeof btoa !== 'undefined') {\n    css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n  } // For old IE\n\n  /* istanbul ignore if  */\n\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    while (style.firstChild) {\n      style.removeChild(style.firstChild);\n    }\n\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n  var style;\n  var update;\n  var remove;\n\n  if (options.singleton) {\n    var styleIndex = singletonCounter++;\n    style = singleton || (singleton = insertStyleElement(options));\n    update = applyToSingletonTag.bind(null, style, styleIndex, false);\n    remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n  } else {\n    style = insertStyleElement(options);\n    update = applyToTag.bind(null, style, options);\n\n    remove = function remove() {\n      removeStyleElement(style);\n    };\n  }\n\n  update(obj);\n  return function updateStyle(newObj) {\n    if (newObj) {\n      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n        return;\n      }\n\n      update(obj = newObj);\n    } else {\n      remove();\n    }\n  };\n}\n\nmodule.exports = function (list, options) {\n  options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n  // tags it will allow on a page\n\n  if (!options.singleton && typeof options.singleton !== 'boolean') {\n    options.singleton = isOldIE();\n  }\n\n  list = list || [];\n  var lastIdentifiers = modulesToDom(list, options);\n  return function update(newList) {\n    newList = newList || [];\n\n    if (Object.prototype.toString.call(newList) !== '[object Array]') {\n      return;\n    }\n\n    for (var i = 0; i < lastIdentifiers.length; i++) {\n      var identifier = lastIdentifiers[i];\n      var index = getIndexByIdentifier(identifier);\n      stylesInDom[index].references--;\n    }\n\n    var newLastIdentifiers = modulesToDom(newList, options);\n\n    for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n      var _identifier = lastIdentifiers[_i];\n\n      var _index = getIndexByIdentifier(_identifier);\n\n      if (stylesInDom[_index].references === 0) {\n        stylesInDom[_index].updater();\n\n        stylesInDom.splice(_index, 1);\n      }\n    }\n\n    lastIdentifiers = newLastIdentifiers;\n  };\n};\n\n/***/ },\n\n/***/ 810\n(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   A: () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body {\\n  background: snow;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n/***/ },\n\n/***/ 935\n(module) {\n\n\"use strict\";\n\n\n/*\n  MIT License http://www.opensource.org/licenses/mit-license.php\n  Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n  var list = []; // return the list of modules as css string\n\n  list.toString = function toString() {\n    return this.map(function (item) {\n      var content = cssWithMappingToString(item);\n\n      if (item[2]) {\n        return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n      }\n\n      return content;\n    }).join('');\n  }; // import a list of modules into the list\n  // eslint-disable-next-line func-names\n\n\n  list.i = function (modules, mediaQuery, dedupe) {\n    if (typeof modules === 'string') {\n      // eslint-disable-next-line no-param-reassign\n      modules = [[null, modules, '']];\n    }\n\n    var alreadyImportedModules = {};\n\n    if (dedupe) {\n      for (var i = 0; i < this.length; i++) {\n        // eslint-disable-next-line prefer-destructuring\n        var id = this[i][0];\n\n        if (id != null) {\n          alreadyImportedModules[id] = true;\n        }\n      }\n    }\n\n    for (var _i = 0; _i < modules.length; _i++) {\n      var item = [].concat(modules[_i]);\n\n      if (dedupe && alreadyImportedModules[item[0]]) {\n        // eslint-disable-next-line no-continue\n        continue;\n      }\n\n      if (mediaQuery) {\n        if (!item[2]) {\n          item[2] = mediaQuery;\n        } else {\n          item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n        }\n      }\n\n      list.push(item);\n    }\n  };\n\n  return list;\n};\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t(() => {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = (module) => {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\t() => (module['default']) :\n/******/ \t\t\t\t() => (module);\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/nonce */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.nc = undefined;\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(192);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/default/dist/webpack-5/index.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"bundle.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/default/example.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/default/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/default/readme.md",
    "content": "# zero-config example\n\nin this example only the default configuration is used\n"
  },
  {
    "path": "examples/default/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [\"style-loader\", \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin()],\n};\n"
  },
  {
    "path": "examples/favicon/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(969);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/favicon/dist/webpack-5/favicon.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>HtmlWebpackPlugin example</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><link rel=\"icon\" href=\"favicon.ico\"><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body></body></html>"
  },
  {
    "path": "examples/favicon/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/favicon/example.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/favicon/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/favicon/template.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Example template</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  </head>\n  <body>\n    <img src=\"logo.png\" />\n  </body>\n</html>\n"
  },
  {
    "path": "examples/favicon/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      title: \"HtmlWebpackPlugin example\",\n      favicon: \"favicon.ico\",\n      filename: \"favicon.html\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/html-loader/dist/webpack-5/about.html",
    "content": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><link rel=\"icon\" href=\"favicon.ico\"><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/html-loader/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(969);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/html-loader/dist/webpack-5/index.html",
    "content": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><link rel=\"icon\" href=\"favicon.ico\"><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/html-loader/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/html-loader/example.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/html-loader/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/html-loader/template.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Example template</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  </head>\n  <body>\n    <img src=\"logo.png\" />\n  </body>\n</html>\n"
  },
  {
    "path": "examples/html-loader/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n      { test: /\\.html$/, loader: \"html-loader\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: \"index.html\",\n      favicon: \"favicon.ico\",\n      template: \"template.html\",\n    }),\n    new HtmlWebpackPlugin({\n      filename: \"about.html\",\n      favicon: \"favicon.ico\",\n      template: \"template.html\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/inline/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n\n__webpack_require__(969);\n\nconsole.log(\"Hello World\");\n\n/******/ })()\n;"
  },
  {
    "path": "examples/inline/dist/webpack-5/index.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>pug demo</title></head><body><style>body {\n  background: snow;\n}</style><script>/******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n\n__webpack_require__(969);\n\nconsole.log(\"Hello World\");\n\n/******/ })()\n;</script></body></html>"
  },
  {
    "path": "examples/inline/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/inline/example.js",
    "content": "\"use strict\";\nrequire(\"./main.css\");\n\nconsole.log(\"Hello World\");\n"
  },
  {
    "path": "examples/inline/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/inline/readme.md",
    "content": "# isomorphic pug example\n\nThis example shows how to use a different template engine (in this case pug)\nto load the `time.pug` template on the backend and frontend.\n"
  },
  {
    "path": "examples/inline/template.pug",
    "content": "doctype html\nhtml\n  head\n    meta(charset=\"utf-8\")\n    title #{htmlWebpackPlugin.options.title}\n  body\n    each cssFile in htmlWebpackPlugin.files.css\n      style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}\n    each jsFile in htmlWebpackPlugin.files.js\n      script !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}\n"
  },
  {
    "path": "examples/inline/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.pug$/, loader: \"pug-loader\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      inject: false,\n      cache: false,\n      template: \"template.pug\",\n      filename: \"index.html\",\n      favicon: \"favicon.ico\",\n      title: \"pug demo\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/javascript/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 48\n(module) {\n\n\"use strict\";\n// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== \"undefined\";\n\nmodule.exports = function () {\n  return \"Hello World from \" + (backend ? \"backend\" : \"frontend\");\n};\n\n\n/***/ },\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(969);\n\nvar universal = __webpack_require__(48);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/javascript/dist/webpack-5/index.html",
    "content": "<head><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head>Hello World from backend2026-01-16T16:38:04.038Z<h2>Partial</h2><img src=\"55b19870aff2e53d1fb1.png\"/>"
  },
  {
    "path": "examples/javascript/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/javascript/example.js",
    "content": "require(\"./main.css\");\n\nvar universal = require(\"./universal.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/javascript/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/javascript/partial.html",
    "content": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
  },
  {
    "path": "examples/javascript/readme.md",
    "content": "# isomorphic javascript example\n\nThis example shows how to generate a template on the fly using javascript.\n\nThe best way to debug the compilation result is `devTool:eval`\n"
  },
  {
    "path": "examples/javascript/template.js",
    "content": "// Webpack require:\nvar partial = require(\"./partial.html\").default;\nvar universal = require(\"./universal.js\");\n\n// Export a function / promise / or a string:\nmodule.exports = universal() + new Date().toISOString() + partial;\n"
  },
  {
    "path": "examples/javascript/universal.js",
    "content": "// This file is used for frontend and backend\n\"use strict\";\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== \"undefined\";\n\nmodule.exports = function () {\n  return \"Hello World from \" + (backend ? \"backend\" : \"frontend\");\n};\n"
  },
  {
    "path": "examples/javascript/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n      { test: /\\.html$/, loader: \"html-loader\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.js\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/javascript-advanced/dist/webpack-5/bundle.js",
    "content": "/*\n * ATTENTION: The \"eval\" devtool has been used (maybe by default in mode: \"development\").\n * This devtool is neither made for production nor for readable output files.\n * It uses \"eval()\" calls to create a separate source file in the browser devtools.\n * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)\n * or disable the default devtool with \"devtool: false\".\n * If you are looking for production-ready output files, see mode: \"production\" (https://webpack.js.org/configuration/mode/).\n */\n/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 48\n(module) {\n\n\"use strict\";\neval(\"{// This file is used for frontend and backend\\n\\n\\n// If compiled by the html-webpack-plugin\\n// HTML_WEBPACK_PLUGIN is set to true:\\nvar backend = typeof HTML_WEBPACK_PLUGIN !== \\\"undefined\\\";\\n\\nmodule.exports = function () {\\n  return \\\"Hello World from \\\" + (backend ? \\\"backend\\\" : \\\"frontend\\\");\\n};\\n\\n\\n//# sourceURL=webpack:///./universal.js?\\n}\");\n\n/***/ },\n\n/***/ 695\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\neval(\"{__webpack_require__(969);\\n\\nvar universal = __webpack_require__(48);\\nvar h1 = document.createElement(\\\"h1\\\");\\nh1.innerHTML = universal();\\n\\ndocument.body.appendChild(h1);\\n\\n\\n//# sourceURL=webpack:///./example.js?\\n}\");\n\n/***/ },\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\neval(\"{__webpack_require__.r(__webpack_exports__);\\n// extracted by mini-css-extract-plugin\\n\\n\\n//# sourceURL=webpack:///./main.css?\\n}\");\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module can't be inlined because the eval devtool is used.\n/******/ \tvar __webpack_exports__ = __webpack_require__(695);\n/******/ \t\n/******/ })()\n;"
  },
  {
    "path": "examples/javascript-advanced/dist/webpack-5/index.html",
    "content": "<html><head><title>Webpack App</title><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body>Hello World from backend -<h2>Partial</h2><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/javascript-advanced/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/javascript-advanced/example.js",
    "content": "require(\"./main.css\");\n\nvar universal = require(\"./universal.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/javascript-advanced/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/javascript-advanced/partial.html",
    "content": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
  },
  {
    "path": "examples/javascript-advanced/readme.md",
    "content": "# isomorphic javascript-advanced example\n\nThis example is similar to the javascript example however it allows takes\nparameters from the config and works asynchronously\n"
  },
  {
    "path": "examples/javascript-advanced/template.js",
    "content": "// Webpack require:\nvar partial = require(\"./partial.html\").default;\nvar universal = require(\"./universal.js\");\n\n// Export a function / promise / or a string:\n// This function has to return a string or promised string:\nmodule.exports = function (templateParams) {\n  var html =\n    \"<html><head>\" +\n    \"<title>\" +\n    templateParams.htmlWebpackPlugin.options.title +\n    \"</title>\" +\n    \"</head><body>\" +\n    universal() +\n    \" - \" +\n    partial +\n    \"</body></html>\";\n\n  return html;\n};\n"
  },
  {
    "path": "examples/javascript-advanced/universal.js",
    "content": "// This file is used for frontend and backend\n\"use strict\";\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== \"undefined\";\n\nmodule.exports = function () {\n  return \"Hello World from \" + (backend ? \"backend\" : \"frontend\");\n};\n"
  },
  {
    "path": "examples/javascript-advanced/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n      { test: /\\.html$/, loader: \"html-loader\" },\n    ],\n  },\n  devtool: \"eval\",\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.js\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/multi-page/dist/webpack-5/first.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"first.js\"></script><script defer=\"defer\" src=\"second.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/multi-page/dist/webpack-5/first.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);\n\n            \n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A, options);\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A.locals || {});\n\n/***/ },\n\n/***/ 591\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isOldIE = function isOldIE() {\n  var memo;\n  return function memorize() {\n    if (typeof memo === 'undefined') {\n      // Test for IE <= 9 as proposed by Browserhacks\n      // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n      // Tests for existence of standard globals is to allow style-loader\n      // to operate correctly into non-standard environments\n      // @see https://github.com/webpack-contrib/style-loader/issues/177\n      memo = Boolean(window && document && document.all && !window.atob);\n    }\n\n    return memo;\n  };\n}();\n\nvar getTarget = function getTarget() {\n  var memo = {};\n  return function memorize(target) {\n    if (typeof memo[target] === 'undefined') {\n      var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n      if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n        try {\n          // This will throw an exception if access to iframe is blocked\n          // due to cross-origin restrictions\n          styleTarget = styleTarget.contentDocument.head;\n        } catch (e) {\n          // istanbul ignore next\n          styleTarget = null;\n        }\n      }\n\n      memo[target] = styleTarget;\n    }\n\n    return memo[target];\n  };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n  var result = -1;\n\n  for (var i = 0; i < stylesInDom.length; i++) {\n    if (stylesInDom[i].identifier === identifier) {\n      result = i;\n      break;\n    }\n  }\n\n  return result;\n}\n\nfunction modulesToDom(list, options) {\n  var idCountMap = {};\n  var identifiers = [];\n\n  for (var i = 0; i < list.length; i++) {\n    var item = list[i];\n    var id = options.base ? item[0] + options.base : item[0];\n    var count = idCountMap[id] || 0;\n    var identifier = \"\".concat(id, \" \").concat(count);\n    idCountMap[id] = count + 1;\n    var index = getIndexByIdentifier(identifier);\n    var obj = {\n      css: item[1],\n      media: item[2],\n      sourceMap: item[3]\n    };\n\n    if (index !== -1) {\n      stylesInDom[index].references++;\n      stylesInDom[index].updater(obj);\n    } else {\n      stylesInDom.push({\n        identifier: identifier,\n        updater: addStyle(obj, options),\n        references: 1\n      });\n    }\n\n    identifiers.push(identifier);\n  }\n\n  return identifiers;\n}\n\nfunction insertStyleElement(options) {\n  var style = document.createElement('style');\n  var attributes = options.attributes || {};\n\n  if (typeof attributes.nonce === 'undefined') {\n    var nonce =  true ? __webpack_require__.nc : 0;\n\n    if (nonce) {\n      attributes.nonce = nonce;\n    }\n  }\n\n  Object.keys(attributes).forEach(function (key) {\n    style.setAttribute(key, attributes[key]);\n  });\n\n  if (typeof options.insert === 'function') {\n    options.insert(style);\n  } else {\n    var target = getTarget(options.insert || 'head');\n\n    if (!target) {\n      throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n    }\n\n    target.appendChild(style);\n  }\n\n  return style;\n}\n\nfunction removeStyleElement(style) {\n  // istanbul ignore if\n  if (style.parentNode === null) {\n    return false;\n  }\n\n  style.parentNode.removeChild(style);\n}\n/* istanbul ignore next  */\n\n\nvar replaceText = function replaceText() {\n  var textStore = [];\n  return function replace(index, replacement) {\n    textStore[index] = replacement;\n    return textStore.filter(Boolean).join('\\n');\n  };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n  var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n  /* istanbul ignore if  */\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = replaceText(index, css);\n  } else {\n    var cssNode = document.createTextNode(css);\n    var childNodes = style.childNodes;\n\n    if (childNodes[index]) {\n      style.removeChild(childNodes[index]);\n    }\n\n    if (childNodes.length) {\n      style.insertBefore(cssNode, childNodes[index]);\n    } else {\n      style.appendChild(cssNode);\n    }\n  }\n}\n\nfunction applyToTag(style, options, obj) {\n  var css = obj.css;\n  var media = obj.media;\n  var sourceMap = obj.sourceMap;\n\n  if (media) {\n    style.setAttribute('media', media);\n  } else {\n    style.removeAttribute('media');\n  }\n\n  if (sourceMap && typeof btoa !== 'undefined') {\n    css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n  } // For old IE\n\n  /* istanbul ignore if  */\n\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    while (style.firstChild) {\n      style.removeChild(style.firstChild);\n    }\n\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n  var style;\n  var update;\n  var remove;\n\n  if (options.singleton) {\n    var styleIndex = singletonCounter++;\n    style = singleton || (singleton = insertStyleElement(options));\n    update = applyToSingletonTag.bind(null, style, styleIndex, false);\n    remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n  } else {\n    style = insertStyleElement(options);\n    update = applyToTag.bind(null, style, options);\n\n    remove = function remove() {\n      removeStyleElement(style);\n    };\n  }\n\n  update(obj);\n  return function updateStyle(newObj) {\n    if (newObj) {\n      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n        return;\n      }\n\n      update(obj = newObj);\n    } else {\n      remove();\n    }\n  };\n}\n\nmodule.exports = function (list, options) {\n  options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n  // tags it will allow on a page\n\n  if (!options.singleton && typeof options.singleton !== 'boolean') {\n    options.singleton = isOldIE();\n  }\n\n  list = list || [];\n  var lastIdentifiers = modulesToDom(list, options);\n  return function update(newList) {\n    newList = newList || [];\n\n    if (Object.prototype.toString.call(newList) !== '[object Array]') {\n      return;\n    }\n\n    for (var i = 0; i < lastIdentifiers.length; i++) {\n      var identifier = lastIdentifiers[i];\n      var index = getIndexByIdentifier(identifier);\n      stylesInDom[index].references--;\n    }\n\n    var newLastIdentifiers = modulesToDom(newList, options);\n\n    for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n      var _identifier = lastIdentifiers[_i];\n\n      var _index = getIndexByIdentifier(_identifier);\n\n      if (stylesInDom[_index].references === 0) {\n        stylesInDom[_index].updater();\n\n        stylesInDom.splice(_index, 1);\n      }\n    }\n\n    lastIdentifiers = newLastIdentifiers;\n  };\n};\n\n/***/ },\n\n/***/ 810\n(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   A: () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body {\\n  background: snow;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n/***/ },\n\n/***/ 935\n(module) {\n\n\"use strict\";\n\n\n/*\n  MIT License http://www.opensource.org/licenses/mit-license.php\n  Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n  var list = []; // return the list of modules as css string\n\n  list.toString = function toString() {\n    return this.map(function (item) {\n      var content = cssWithMappingToString(item);\n\n      if (item[2]) {\n        return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n      }\n\n      return content;\n    }).join('');\n  }; // import a list of modules into the list\n  // eslint-disable-next-line func-names\n\n\n  list.i = function (modules, mediaQuery, dedupe) {\n    if (typeof modules === 'string') {\n      // eslint-disable-next-line no-param-reassign\n      modules = [[null, modules, '']];\n    }\n\n    var alreadyImportedModules = {};\n\n    if (dedupe) {\n      for (var i = 0; i < this.length; i++) {\n        // eslint-disable-next-line prefer-destructuring\n        var id = this[i][0];\n\n        if (id != null) {\n          alreadyImportedModules[id] = true;\n        }\n      }\n    }\n\n    for (var _i = 0; _i < modules.length; _i++) {\n      var item = [].concat(modules[_i]);\n\n      if (dedupe && alreadyImportedModules[item[0]]) {\n        // eslint-disable-next-line no-continue\n        continue;\n      }\n\n      if (mediaQuery) {\n        if (!item[2]) {\n          item[2] = mediaQuery;\n        } else {\n          item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n        }\n      }\n\n      list.push(item);\n    }\n  };\n\n  return list;\n};\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t(() => {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = (module) => {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\t() => (module['default']) :\n/******/ \t\t\t\t() => (module);\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/nonce */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.nc = undefined;\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(192);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/multi-page/dist/webpack-5/second.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><script defer=\"defer\" src=\"first.js\"></script><script defer=\"defer\" src=\"second.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/multi-page/dist/webpack-5/second.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);\n\n            \n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A, options);\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A.locals || {});\n\n/***/ },\n\n/***/ 591\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isOldIE = function isOldIE() {\n  var memo;\n  return function memorize() {\n    if (typeof memo === 'undefined') {\n      // Test for IE <= 9 as proposed by Browserhacks\n      // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n      // Tests for existence of standard globals is to allow style-loader\n      // to operate correctly into non-standard environments\n      // @see https://github.com/webpack-contrib/style-loader/issues/177\n      memo = Boolean(window && document && document.all && !window.atob);\n    }\n\n    return memo;\n  };\n}();\n\nvar getTarget = function getTarget() {\n  var memo = {};\n  return function memorize(target) {\n    if (typeof memo[target] === 'undefined') {\n      var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n      if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n        try {\n          // This will throw an exception if access to iframe is blocked\n          // due to cross-origin restrictions\n          styleTarget = styleTarget.contentDocument.head;\n        } catch (e) {\n          // istanbul ignore next\n          styleTarget = null;\n        }\n      }\n\n      memo[target] = styleTarget;\n    }\n\n    return memo[target];\n  };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n  var result = -1;\n\n  for (var i = 0; i < stylesInDom.length; i++) {\n    if (stylesInDom[i].identifier === identifier) {\n      result = i;\n      break;\n    }\n  }\n\n  return result;\n}\n\nfunction modulesToDom(list, options) {\n  var idCountMap = {};\n  var identifiers = [];\n\n  for (var i = 0; i < list.length; i++) {\n    var item = list[i];\n    var id = options.base ? item[0] + options.base : item[0];\n    var count = idCountMap[id] || 0;\n    var identifier = \"\".concat(id, \" \").concat(count);\n    idCountMap[id] = count + 1;\n    var index = getIndexByIdentifier(identifier);\n    var obj = {\n      css: item[1],\n      media: item[2],\n      sourceMap: item[3]\n    };\n\n    if (index !== -1) {\n      stylesInDom[index].references++;\n      stylesInDom[index].updater(obj);\n    } else {\n      stylesInDom.push({\n        identifier: identifier,\n        updater: addStyle(obj, options),\n        references: 1\n      });\n    }\n\n    identifiers.push(identifier);\n  }\n\n  return identifiers;\n}\n\nfunction insertStyleElement(options) {\n  var style = document.createElement('style');\n  var attributes = options.attributes || {};\n\n  if (typeof attributes.nonce === 'undefined') {\n    var nonce =  true ? __webpack_require__.nc : 0;\n\n    if (nonce) {\n      attributes.nonce = nonce;\n    }\n  }\n\n  Object.keys(attributes).forEach(function (key) {\n    style.setAttribute(key, attributes[key]);\n  });\n\n  if (typeof options.insert === 'function') {\n    options.insert(style);\n  } else {\n    var target = getTarget(options.insert || 'head');\n\n    if (!target) {\n      throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n    }\n\n    target.appendChild(style);\n  }\n\n  return style;\n}\n\nfunction removeStyleElement(style) {\n  // istanbul ignore if\n  if (style.parentNode === null) {\n    return false;\n  }\n\n  style.parentNode.removeChild(style);\n}\n/* istanbul ignore next  */\n\n\nvar replaceText = function replaceText() {\n  var textStore = [];\n  return function replace(index, replacement) {\n    textStore[index] = replacement;\n    return textStore.filter(Boolean).join('\\n');\n  };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n  var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n  /* istanbul ignore if  */\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = replaceText(index, css);\n  } else {\n    var cssNode = document.createTextNode(css);\n    var childNodes = style.childNodes;\n\n    if (childNodes[index]) {\n      style.removeChild(childNodes[index]);\n    }\n\n    if (childNodes.length) {\n      style.insertBefore(cssNode, childNodes[index]);\n    } else {\n      style.appendChild(cssNode);\n    }\n  }\n}\n\nfunction applyToTag(style, options, obj) {\n  var css = obj.css;\n  var media = obj.media;\n  var sourceMap = obj.sourceMap;\n\n  if (media) {\n    style.setAttribute('media', media);\n  } else {\n    style.removeAttribute('media');\n  }\n\n  if (sourceMap && typeof btoa !== 'undefined') {\n    css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n  } // For old IE\n\n  /* istanbul ignore if  */\n\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    while (style.firstChild) {\n      style.removeChild(style.firstChild);\n    }\n\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n  var style;\n  var update;\n  var remove;\n\n  if (options.singleton) {\n    var styleIndex = singletonCounter++;\n    style = singleton || (singleton = insertStyleElement(options));\n    update = applyToSingletonTag.bind(null, style, styleIndex, false);\n    remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n  } else {\n    style = insertStyleElement(options);\n    update = applyToTag.bind(null, style, options);\n\n    remove = function remove() {\n      removeStyleElement(style);\n    };\n  }\n\n  update(obj);\n  return function updateStyle(newObj) {\n    if (newObj) {\n      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n        return;\n      }\n\n      update(obj = newObj);\n    } else {\n      remove();\n    }\n  };\n}\n\nmodule.exports = function (list, options) {\n  options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n  // tags it will allow on a page\n\n  if (!options.singleton && typeof options.singleton !== 'boolean') {\n    options.singleton = isOldIE();\n  }\n\n  list = list || [];\n  var lastIdentifiers = modulesToDom(list, options);\n  return function update(newList) {\n    newList = newList || [];\n\n    if (Object.prototype.toString.call(newList) !== '[object Array]') {\n      return;\n    }\n\n    for (var i = 0; i < lastIdentifiers.length; i++) {\n      var identifier = lastIdentifiers[i];\n      var index = getIndexByIdentifier(identifier);\n      stylesInDom[index].references--;\n    }\n\n    var newLastIdentifiers = modulesToDom(newList, options);\n\n    for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n      var _identifier = lastIdentifiers[_i];\n\n      var _index = getIndexByIdentifier(_identifier);\n\n      if (stylesInDom[_index].references === 0) {\n        stylesInDom[_index].updater();\n\n        stylesInDom.splice(_index, 1);\n      }\n    }\n\n    lastIdentifiers = newLastIdentifiers;\n  };\n};\n\n/***/ },\n\n/***/ 810\n(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   A: () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body {\\n  background: snow;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n/***/ },\n\n/***/ 935\n(module) {\n\n\"use strict\";\n\n\n/*\n  MIT License http://www.opensource.org/licenses/mit-license.php\n  Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n  var list = []; // return the list of modules as css string\n\n  list.toString = function toString() {\n    return this.map(function (item) {\n      var content = cssWithMappingToString(item);\n\n      if (item[2]) {\n        return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n      }\n\n      return content;\n    }).join('');\n  }; // import a list of modules into the list\n  // eslint-disable-next-line func-names\n\n\n  list.i = function (modules, mediaQuery, dedupe) {\n    if (typeof modules === 'string') {\n      // eslint-disable-next-line no-param-reassign\n      modules = [[null, modules, '']];\n    }\n\n    var alreadyImportedModules = {};\n\n    if (dedupe) {\n      for (var i = 0; i < this.length; i++) {\n        // eslint-disable-next-line prefer-destructuring\n        var id = this[i][0];\n\n        if (id != null) {\n          alreadyImportedModules[id] = true;\n        }\n      }\n    }\n\n    for (var _i = 0; _i < modules.length; _i++) {\n      var item = [].concat(modules[_i]);\n\n      if (dedupe && alreadyImportedModules[item[0]]) {\n        // eslint-disable-next-line no-continue\n        continue;\n      }\n\n      if (mediaQuery) {\n        if (!item[2]) {\n          item[2] = mediaQuery;\n        } else {\n          item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n        }\n      }\n\n      list.push(item);\n    }\n  };\n\n  return list;\n};\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t(() => {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = (module) => {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\t() => (module['default']) :\n/******/ \t\t\t\t() => (module);\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/nonce */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.nc = undefined;\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(192);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/multi-page/first.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/multi-page/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/multi-page/readme.md",
    "content": "# zero-config example\n\nin this example only the default configuration is used\n"
  },
  {
    "path": "examples/multi-page/second.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/multi-page/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: {\n    first: \"./first.js\",\n    second: \"./second.js\",\n  },\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"[name].js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [\"style-loader\", \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: \"[name].html\",\n    }),\n  ],\n};\n"
  },
  {
    "path": "examples/pug-loader/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 355\n(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar pug_has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * Merge two attribute objects giving precedence\n * to values in object `b`. Classes are special-cased\n * allowing for arrays and merging/joining appropriately\n * resulting in a string.\n *\n * @param {Object} a\n * @param {Object} b\n * @return {Object} a\n * @api private\n */\n\nexports.merge = pug_merge;\nfunction pug_merge(a, b) {\n  if (arguments.length === 1) {\n    var attrs = a[0];\n    for (var i = 1; i < a.length; i++) {\n      attrs = pug_merge(attrs, a[i]);\n    }\n    return attrs;\n  }\n\n  for (var key in b) {\n    if (key === 'class') {\n      var valA = a[key] || [];\n      a[key] = (Array.isArray(valA) ? valA : [valA]).concat(b[key] || []);\n    } else if (key === 'style') {\n      var valA = pug_style(a[key]);\n      valA = valA && valA[valA.length - 1] !== ';' ? valA + ';' : valA;\n      var valB = pug_style(b[key]);\n      valB = valB && valB[valB.length - 1] !== ';' ? valB + ';' : valB;\n      a[key] = valA + valB;\n    } else {\n      a[key] = b[key];\n    }\n  }\n\n  return a;\n}\n\n/**\n * Process array, object, or string as a string of classes delimited by a space.\n *\n * If `val` is an array, all members of it and its subarrays are counted as\n * classes. If `escaping` is an array, then whether or not the item in `val` is\n * escaped depends on the corresponding item in `escaping`. If `escaping` is\n * not an array, no escaping is done.\n *\n * If `val` is an object, all the keys whose value is truthy are counted as\n * classes. No escaping is done.\n *\n * If `val` is a string, it is counted as a class. No escaping is done.\n *\n * @param {(Array.<string>|Object.<string, boolean>|string)} val\n * @param {?Array.<string>} escaping\n * @return {String}\n */\nexports.classes = pug_classes;\nfunction pug_classes_array(val, escaping) {\n  var classString = '',\n    className,\n    padding = '',\n    escapeEnabled = Array.isArray(escaping);\n  for (var i = 0; i < val.length; i++) {\n    className = pug_classes(val[i]);\n    if (!className) continue;\n    escapeEnabled && escaping[i] && (className = pug_escape(className));\n    classString = classString + padding + className;\n    padding = ' ';\n  }\n  return classString;\n}\nfunction pug_classes_object(val) {\n  var classString = '',\n    padding = '';\n  for (var key in val) {\n    if (key && val[key] && pug_has_own_property.call(val, key)) {\n      classString = classString + padding + key;\n      padding = ' ';\n    }\n  }\n  return classString;\n}\nfunction pug_classes(val, escaping) {\n  if (Array.isArray(val)) {\n    return pug_classes_array(val, escaping);\n  } else if (val && typeof val === 'object') {\n    return pug_classes_object(val);\n  } else {\n    return val || '';\n  }\n}\n\n/**\n * Convert object or string to a string of CSS styles delimited by a semicolon.\n *\n * @param {(Object.<string, string>|string)} val\n * @return {String}\n */\n\nexports.style = pug_style;\nfunction pug_style(val) {\n  if (!val) return '';\n  if (typeof val === 'object') {\n    var out = '';\n    for (var style in val) {\n      /* istanbul ignore else */\n      if (pug_has_own_property.call(val, style)) {\n        out = out + style + ':' + val[style] + ';';\n      }\n    }\n    return out;\n  } else {\n    return val + '';\n  }\n}\n\n/**\n * Render the given attribute.\n *\n * @param {String} key\n * @param {String} val\n * @param {Boolean} escaped\n * @param {Boolean} terse\n * @return {String}\n */\nexports.attr = pug_attr;\nfunction pug_attr(key, val, escaped, terse) {\n  if (\n    val === false ||\n    val == null ||\n    (!val && (key === 'class' || key === 'style'))\n  ) {\n    return '';\n  }\n  if (val === true) {\n    return ' ' + (terse ? key : key + '=\"' + key + '\"');\n  }\n  var type = typeof val;\n  if (\n    (type === 'object' || type === 'function') &&\n    typeof val.toJSON === 'function'\n  ) {\n    val = val.toJSON();\n  }\n  if (typeof val !== 'string') {\n    val = JSON.stringify(val);\n    if (!escaped && val.indexOf('\"') !== -1) {\n      return ' ' + key + \"='\" + val.replace(/'/g, '&#39;') + \"'\";\n    }\n  }\n  if (escaped) val = pug_escape(val);\n  return ' ' + key + '=\"' + val + '\"';\n}\n\n/**\n * Render the given attributes object.\n *\n * @param {Object} obj\n * @param {Object} terse whether to use HTML5 terse boolean attributes\n * @return {String}\n */\nexports.attrs = pug_attrs;\nfunction pug_attrs(obj, terse) {\n  var attrs = '';\n\n  for (var key in obj) {\n    if (pug_has_own_property.call(obj, key)) {\n      var val = obj[key];\n\n      if ('class' === key) {\n        val = pug_classes(val);\n        attrs = pug_attr(key, val, false, terse) + attrs;\n        continue;\n      }\n      if ('style' === key) {\n        val = pug_style(val);\n      }\n      attrs += pug_attr(key, val, false, terse);\n    }\n  }\n\n  return attrs;\n}\n\n/**\n * Escape the given string of `html`.\n *\n * @param {String} html\n * @return {String}\n * @api private\n */\n\nvar pug_match_html = /[\"&<>]/;\nexports.escape = pug_escape;\nfunction pug_escape(_html) {\n  var html = '' + _html;\n  var regexResult = pug_match_html.exec(html);\n  if (!regexResult) return _html;\n\n  var result = '';\n  var i, lastIndex, escape;\n  for (i = regexResult.index, lastIndex = 0; i < html.length; i++) {\n    switch (html.charCodeAt(i)) {\n      case 34:\n        escape = '&quot;';\n        break;\n      case 38:\n        escape = '&amp;';\n        break;\n      case 60:\n        escape = '&lt;';\n        break;\n      case 62:\n        escape = '&gt;';\n        break;\n      default:\n        continue;\n    }\n    if (lastIndex !== i) result += html.substring(lastIndex, i);\n    lastIndex = i + 1;\n    result += escape;\n  }\n  if (lastIndex !== i) return result + html.substring(lastIndex, i);\n  else return result;\n}\n\n/**\n * Re-throw the given `err` in context to the\n * the pug in `filename` at the given `lineno`.\n *\n * @param {Error} err\n * @param {String} filename\n * @param {String} lineno\n * @param {String} str original source\n * @api private\n */\n\nexports.rethrow = pug_rethrow;\nfunction pug_rethrow(err, filename, lineno, str) {\n  if (!(err instanceof Error)) throw err;\n  if ((typeof window != 'undefined' || !filename) && !str) {\n    err.message += ' on line ' + lineno;\n    throw err;\n  }\n  var context, lines, start, end;\n  try {\n    str = str || (__webpack_require__(900).readFileSync)(filename, {encoding: 'utf8'});\n    context = 3;\n    lines = str.split('\\n');\n    start = Math.max(lineno - context, 0);\n    end = Math.min(lines.length, lineno + context);\n  } catch (ex) {\n    err.message +=\n      ' - could not read from ' + filename + ' (' + ex.message + ')';\n    pug_rethrow(err, null, lineno);\n    return;\n  }\n\n  // Error context\n  context = lines\n    .slice(start, end)\n    .map(function(line, i) {\n      var curr = i + start + 1;\n      return (curr == lineno ? '  > ' : '    ') + curr + '| ' + line;\n    })\n    .join('\\n');\n\n  // Alter exception message\n  err.path = filename;\n  try {\n    err.message =\n      (filename || 'Pug') +\n      ':' +\n      lineno +\n      '\\n' +\n      context +\n      '\\n\\n' +\n      err.message;\n  } catch (e) {}\n  throw err;\n}\n\n\n/***/ },\n\n/***/ 487\n(module, __unused_webpack_exports, __webpack_require__) {\n\nvar pug = __webpack_require__(355);\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;;\n    var locals_for_with = (locals || {});\n    \n    (function (time) {\n      pug_html = pug_html + \"\\u003C!-- this partial is used for frontend and backend--\\u003E\\u003Cdiv class=\\\"time\\\"\\u003E \\u003Cb\\u003ECurrent time\\u003C\\u002Fb\\u003E\\u003Cp\\u003E\" + (pug.escape(null == (pug_interp = time.toISOString()) ? \"\" : pug_interp)) + \"\\u003C\\u002Fp\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cimg src=\\\"#{require('.\\u002Flogo.png')}\\\"\\u003E\";\n    }.call(this, \"time\" in locals_for_with ?\n        locals_for_with.time :\n        typeof time !== 'undefined' ? time : undefined));\n    ;;return pug_html;};\nmodule.exports = template;\n\n/***/ },\n\n/***/ 900\n() {\n\n/* (ignored) */\n\n/***/ },\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.\n(() => {\n\"use strict\";\n\n__webpack_require__(969);\n// Use the same template for the frontend code\nvar template = __webpack_require__(487);\n\nsetInterval(function () {\n  var div = document.getElementById(\"main\");\n  div.innerHTML = template({ time: new Date() });\n  div.style.color = \"navy\";\n}, 1000);\n\n})();\n\n/******/ })()\n;"
  },
  {
    "path": "examples/pug-loader/dist/webpack-5/index.html",
    "content": "<!doctype html><html><head><title>pug demo</title><link rel=\"icon\" href=\"favicon.ico\"><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><div id=\"main\"><div class=\"time\"><b>Current time</b><p>1998-12-31T21:00:00.000Z</p></div><img src=\"#{require('./logo.png')}\"></div></body></html>"
  },
  {
    "path": "examples/pug-loader/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/pug-loader/example.js",
    "content": "\"use strict\";\nrequire(\"./main.css\");\n// Use the same template for the frontend code\nvar template = require(\"./time.pug\");\n\nsetInterval(function () {\n  var div = document.getElementById(\"main\");\n  div.innerHTML = template({ time: new Date() });\n  div.style.color = \"navy\";\n}, 1000);\n"
  },
  {
    "path": "examples/pug-loader/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/pug-loader/readme.md",
    "content": "# isomorphic pug example\n\nThis example shows how to use a different template engine (in this case pug)\nto load the `time.pug` template on the backend and frontend.\n"
  },
  {
    "path": "examples/pug-loader/template.pug",
    "content": "doctype html\nhtml\n  head\n    title= htmlWebpackPlugin.options.title\n  body\n    #main\n      - locals.time = new Date('01 01, 1999');\n      include ./time.pug"
  },
  {
    "path": "examples/pug-loader/time.pug",
    "content": "// this partial is used for frontend and backend\n.time \n  b Current time\n  p #{time.toISOString()}\n  \nimg(src=\"#{require('./logo.png')}\")"
  },
  {
    "path": "examples/pug-loader/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\n\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n      { test: /\\.pug$/, loader: \"pug-loader\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      filename: \"index.html\",\n      favicon: \"favicon.ico\",\n      template: \"template.pug\",\n      title: \"pug demo\",\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/sort-manually/a.js",
    "content": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"a!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/sort-manually/b.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"b!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/sort-manually/c.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"c!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/sort-manually/d.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"d!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/a.js",
    "content": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n/***/ }\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n__webpack_require__(969);\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"a!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/b.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"b!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/c.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"c!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/d.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"d!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/e.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"e!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/first-file.html",
    "content": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><script defer=\"defer\" src=\"a.js\"></script><script defer=\"defer\" src=\"b.js\"></script><script defer=\"defer\" src=\"c.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/second-file.html",
    "content": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><script defer=\"defer\" src=\"a.js\"></script><script defer=\"defer\" src=\"b.js\"></script><script defer=\"defer\" src=\"d.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head><body><img src=\"55b19870aff2e53d1fb1.png\"/></body></html>"
  },
  {
    "path": "examples/sort-manually/dist/webpack-5/styles.css",
    "content": "body {\n  background: snow;\n}\n\n"
  },
  {
    "path": "examples/sort-manually/e.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"e!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/sort-manually/main.css",
    "content": "body {\n  background: snow;\n}\n"
  },
  {
    "path": "examples/sort-manually/template.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Example template</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  </head>\n  <body>\n    <img src=\"logo.png\" />\n  </body>\n</html>\n"
  },
  {
    "path": "examples/sort-manually/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\nmodule.exports = {\n  context: __dirname,\n  entry: {\n    b: \"./b.js\",\n    d: \"./d.js\",\n    a: \"./a.js\",\n    c: \"./c.js\",\n    e: \"./e.js\",\n  },\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"[name].js\",\n  },\n  module: {\n    rules: [\n      { test: /\\.css$/, use: [MiniCssExtractPlugin.loader, \"css-loader\"] },\n      { test: /\\.png$/, type: \"asset/resource\" },\n      { test: /\\.html$/, loader: \"html-loader\" },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      inject: true,\n      filename: \"first-file.html\",\n      template: \"template.html\",\n      chunksSortMode: \"manual\",\n      chunks: [\"a\", \"b\", \"c\"],\n    }),\n    new HtmlWebpackPlugin({\n      inject: true,\n      filename: \"second-file.html\",\n      template: \"template.html\",\n      chunksSortMode: \"manual\",\n      chunks: [\"a\", \"b\", \"d\"],\n    }),\n    new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n  ],\n};\n"
  },
  {
    "path": "examples/template-parameters/dist/webpack-5/bundle.js",
    "content": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n\n/******/ })()\n;"
  },
  {
    "path": "examples/template-parameters/dist/webpack-5/index.html",
    "content": "<!doctype html><html><head><meta charset=\"utf-8\"><title>bar</title><script defer=\"defer\" src=\"bundle.js\"></script></head><body></body></html>"
  },
  {
    "path": "examples/template-parameters/example.js",
    "content": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
  },
  {
    "path": "examples/template-parameters/index.ejs",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title><%= foo %></title>\n  </head>\n  <body>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/template-parameters/readme.md",
    "content": "# template parameters example\n\nThis example shows how you can overwrite the built in template parameters\n"
  },
  {
    "path": "examples/template-parameters/webpack.config.js",
    "content": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package.json\").version.split(\".\")[0];\nmodule.exports = {\n  context: __dirname,\n  entry: \"./example.js\",\n  output: {\n    path: path.join(__dirname, \"dist/webpack-\" + webpackMajorVersion),\n    publicPath: \"\",\n    filename: \"bundle.js\",\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      // If you pass a plain object, it will be merged with the default values\n      // (New in version 4)\n      templateParameters: {\n        foo: \"bar\",\n      },\n      // Or if you want full control, pass a function\n      // templateParameters: (compilation, assets, assetTags, options) => {\n      //   return {\n      //     compilation,\n      //     webpackConfig: compilation.options,\n      //     htmlWebpackPlugin: {\n      //       tags: assetTags,\n      //       files: assets,\n      //       options\n      //     },\n      //     'foo': 'bar'\n      //   };\n      // },\n      template: \"index.ejs\",\n    }),\n  ],\n};\n"
  },
  {
    "path": "flow.puml",
    "content": "@startuml\n' See docs http://plantuml.com/sequence.html\n'\n' generate png:\n' npm run puml\nautonumber\n\nparticipant Webpack\nparticipant ChildCompiler\nparticipant TagCreator\nparticipant TemplateExecutor\nparticipant TagInjector\n\nWebpack -> ChildCompiler : start child compilation\nChildCompiler -> ChildCompiler : compile html template\nChildCompiler -> TemplateExecutor : handover compiled template\nWebpack -> TagCreator : hand over compilation\\n assets\nnote right of TagInjector: beforeAssetTagGeneration\nTagCreator -> TagCreator : create script style\\n and meta tags\nnote right of TagInjector: alterAssetTags\nTagCreator -> TagCreator : group tags to\\n head and body groups\nnote right of TagInjector: alterAssetTagGroups\nTagCreator -> TemplateExecutor : handover tag groups\nTemplateExecutor -> TemplateExecutor : execute compiled template\nnote right of TagInjector: afterTemplateExecution\nTemplateExecutor -> TagInjector : handover html\nTagInjector -> TagInjector : inject script style\\n and meta tags\nnote right of TagInjector: beforeEmit\nTagInjector -> Webpack : add generated file to\\n assets\nnote right of TagInjector: afterEmit\n\n@enduml"
  },
  {
    "path": "index.js",
    "content": "// @ts-check\n\"use strict\";\n\nconst promisify = require(\"util\").promisify;\n\nconst vm = require(\"vm\");\nconst fs = require(\"fs\");\nconst _uniq = require(\"lodash/uniq\");\nconst path = require(\"path\");\nconst { CachedChildCompilation } = require(\"./lib/cached-child-compiler\");\n\nconst {\n  createHtmlTagObject,\n  htmlTagObjectToString,\n  HtmlTagArray,\n} = require(\"./lib/html-tags\");\nconst prettyError = require(\"./lib/errors.js\");\nconst chunkSorter = require(\"./lib/chunksorter.js\");\nconst { AsyncSeriesWaterfallHook } = require(\"tapable\");\n\n/** @typedef {import(\"./typings\").HtmlTagObject} HtmlTagObject */\n/** @typedef {import(\"./typings\").Options} HtmlWebpackOptions */\n/** @typedef {import(\"./typings\").ProcessedOptions} ProcessedHtmlWebpackOptions */\n/** @typedef {import(\"./typings\").TemplateParameter} TemplateParameter */\n/** @typedef {import(\"webpack\").Compiler} Compiler */\n/** @typedef {import(\"webpack\").Compilation} Compilation */\n/** @typedef {Required<Compilation[\"outputOptions\"][\"publicPath\"]>} PublicPath */\n/** @typedef {ReturnType<Compiler[\"getInfrastructureLogger\"]>} Logger */\n/** @typedef {Compilation[\"entrypoints\"] extends Map<string, infer I> ? I : never} Entrypoint */\n/** @typedef {Array<{ name: string, source: import('webpack').sources.Source, info?: import('webpack').AssetInfo }>} PreviousEmittedAssets */\n/** @typedef {{ publicPath: string, js: Array<string>, css: Array<string>, manifest?: string, favicon?: string }} AssetsInformationByGroups */\n/** @typedef {import(\"./typings\").Hooks} HtmlWebpackPluginHooks */\n/**\n * @type {WeakMap<Compilation, HtmlWebpackPluginHooks>}}\n */\nconst compilationHooksMap = new WeakMap();\n\nclass HtmlWebpackPlugin {\n  // The following is the API definition for all available hooks\n  // For the TypeScript definition, see the Hooks type in typings.d.ts\n  /**\n   beforeAssetTagGeneration:\n   AsyncSeriesWaterfallHook<{\n      assets: {\n        publicPath: string,\n        js: Array<string>,\n        css: Array<string>,\n        favicon?: string | undefined,\n        manifest?: string | undefined\n      },\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   alterAssetTags:\n   AsyncSeriesWaterfallHook<{\n      assetTags: {\n        scripts: Array<HtmlTagObject>,\n        styles: Array<HtmlTagObject>,\n        meta: Array<HtmlTagObject>,\n      },\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   alterAssetTagGroups:\n   AsyncSeriesWaterfallHook<{\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   afterTemplateExecution:\n   AsyncSeriesWaterfallHook<{\n      html: string,\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>,\n   beforeEmit:\n   AsyncSeriesWaterfallHook<{\n      html: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>,\n   afterEmit:\n   AsyncSeriesWaterfallHook<{\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n   */\n\n  /**\n   * Returns all public hooks of the html webpack plugin for the given compilation\n   *\n   * @param {Compilation} compilation\n   * @returns {HtmlWebpackPluginHooks}\n   */\n  static getCompilationHooks(compilation) {\n    let hooks = compilationHooksMap.get(compilation);\n\n    if (!hooks) {\n      hooks = {\n        beforeAssetTagGeneration: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        alterAssetTags: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        alterAssetTagGroups: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        afterTemplateExecution: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        beforeEmit: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        afterEmit: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n      };\n      compilationHooksMap.set(compilation, hooks);\n    }\n\n    return hooks;\n  }\n\n  /**\n   * @param {HtmlWebpackOptions} [options]\n   */\n  constructor(options) {\n    /** @type {HtmlWebpackOptions} */\n    // TODO remove me in the next major release\n    this.userOptions = options || {};\n    this.version = HtmlWebpackPlugin.version;\n\n    // Default options\n    /** @type {ProcessedHtmlWebpackOptions} */\n    const defaultOptions = {\n      template: \"auto\",\n      templateContent: false,\n      templateParameters: templateParametersGenerator,\n      filename: \"index.html\",\n      publicPath:\n        this.userOptions.publicPath === undefined\n          ? \"auto\"\n          : this.userOptions.publicPath,\n      hash: false,\n      inject: this.userOptions.scriptLoading === \"blocking\" ? \"body\" : \"head\",\n      scriptLoading: \"defer\",\n      compile: true,\n      favicon: false,\n      minify: \"auto\",\n      cache: true,\n      showErrors: true,\n      chunks: \"all\",\n      excludeChunks: [],\n      chunksSortMode: \"auto\",\n      meta: {},\n      base: false,\n      title: \"Webpack App\",\n      xhtml: false,\n    };\n\n    /** @type {ProcessedHtmlWebpackOptions} */\n    this.options = Object.assign(defaultOptions, this.userOptions);\n  }\n\n  /**\n   *\n   * @param {Compiler} compiler\n   * @returns {void}\n   */\n  apply(compiler) {\n    this.logger = compiler.getInfrastructureLogger(\"HtmlWebpackPlugin\");\n\n    const options = this.options;\n\n    options.template = this.getTemplatePath(\n      this.options.template,\n      compiler.context,\n    );\n\n    // Assert correct option spelling\n    if (\n      options.scriptLoading !== \"defer\" &&\n      options.scriptLoading !== \"blocking\" &&\n      options.scriptLoading !== \"module\" &&\n      options.scriptLoading !== \"systemjs-module\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        'The \"scriptLoading\" option need to be set to \"defer\", \"blocking\" or \"module\" or \"systemjs-module\"',\n      );\n    }\n\n    if (\n      options.inject !== true &&\n      options.inject !== false &&\n      options.inject !== \"head\" &&\n      options.inject !== \"body\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        'The `inject` option needs to be set to true, false, \"head\" or \"body',\n      );\n    }\n\n    if (\n      this.options.templateParameters !== false &&\n      typeof this.options.templateParameters !== \"function\" &&\n      typeof this.options.templateParameters !== \"object\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        \"The `templateParameters` has to be either a function or an object or false\",\n      );\n    }\n\n    // Default metaOptions if no template is provided\n    if (\n      !this.userOptions.template &&\n      options.templateContent === false &&\n      options.meta\n    ) {\n      options.meta = Object.assign(\n        {},\n        options.meta,\n        {\n          // TODO remove in the next major release\n          // From https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag\n          viewport: \"width=device-width, initial-scale=1\",\n        },\n        this.userOptions.meta,\n      );\n    }\n\n    // entryName to fileName conversion function\n    const userOptionFilename =\n      this.userOptions.filename || this.options.filename;\n    const filenameFunction =\n      typeof userOptionFilename === \"function\"\n        ? userOptionFilename\n        : // Replace '[name]' with entry name\n          (entryName) => userOptionFilename.replace(/\\[name\\]/g, entryName);\n\n    /** output filenames for the given entry names */\n    const entryNames = Object.keys(compiler.options.entry);\n    const outputFileNames = new Set(\n      (entryNames.length ? entryNames : [\"main\"]).map(filenameFunction),\n    );\n\n    // Hook all options into the webpack compiler\n    outputFileNames.forEach((outputFileName) => {\n      // Instance variables to keep caching information for multiple builds\n      const assetJson = { value: undefined };\n      /**\n       * store the previous generated asset to emit them even if the content did not change\n       * to support watch mode for third party plugins like the clean-webpack-plugin or the compression plugin\n       * @type {PreviousEmittedAssets}\n       */\n      const previousEmittedAssets = [];\n\n      // Inject child compiler plugin\n      const childCompilerPlugin = new CachedChildCompilation(compiler);\n\n      if (!this.options.templateContent) {\n        childCompilerPlugin.addEntry(this.options.template);\n      }\n\n      // convert absolute filename into relative so that webpack can\n      // generate it at correct location\n      let filename = outputFileName;\n\n      if (path.resolve(filename) === path.normalize(filename)) {\n        const outputPath =\n          /** @type {string} - Once initialized the path is always a string */ (\n            compiler.options.output.path\n          );\n\n        filename = path.relative(outputPath, filename);\n      }\n\n      compiler.hooks.thisCompilation.tap(\n        \"HtmlWebpackPlugin\",\n        /**\n         * Hook into the webpack compilation\n         * @param {Compilation} compilation\n         */\n        (compilation) => {\n          compilation.hooks.processAssets.tapAsync(\n            {\n              name: \"HtmlWebpackPlugin\",\n              stage:\n                /**\n                 * Generate the html after minification and dev tooling is done\n                 */\n                compiler.webpack.Compilation\n                  .PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,\n            },\n            /**\n             * Hook into the process assets hook\n             * @param {any} _\n             * @param {(err?: Error) => void} callback\n             */\n            (_, callback) => {\n              this.generateHTML(\n                compiler,\n                compilation,\n                filename,\n                childCompilerPlugin,\n                previousEmittedAssets,\n                assetJson,\n                callback,\n              );\n            },\n          );\n        },\n      );\n    });\n  }\n\n  /**\n   * Helper to return the absolute template path with a fallback loader\n   *\n   * @private\n   * @param {string} template The path to the template e.g. './index.html'\n   * @param {string} context The webpack base resolution path for relative paths e.g. process.cwd()\n   */\n  getTemplatePath(template, context) {\n    if (template === \"auto\") {\n      template = path.resolve(context, \"src/index.ejs\");\n      if (!fs.existsSync(template)) {\n        template = path.join(__dirname, \"default_index.ejs\");\n      }\n    }\n\n    // If the template doesn't use a loader use the lodash template loader\n    if (template.indexOf(\"!\") === -1) {\n      template =\n        require.resolve(\"./lib/loader.js\") +\n        \"!\" +\n        path.resolve(context, template);\n    }\n\n    // Resolve template path\n    return template.replace(\n      /([!])([^/\\\\][^!?]+|[^/\\\\!?])($|\\?[^!?\\n]+$)/,\n      (match, prefix, filepath, postfix) =>\n        prefix + path.resolve(filepath) + postfix,\n    );\n  }\n\n  /**\n   * Return all chunks from the compilation result which match the exclude and include filters\n   *\n   * @private\n   * @param {any} chunks\n   * @param {string[]|'all'} includedChunks\n   * @param {string[]} excludedChunks\n   */\n  filterEntryChunks(chunks, includedChunks, excludedChunks) {\n    return chunks.filter((chunkName) => {\n      // Skip if the chunks should be filtered and the given chunk was not added explicity\n      if (\n        Array.isArray(includedChunks) &&\n        includedChunks.indexOf(chunkName) === -1\n      ) {\n        return false;\n      }\n\n      // Skip if the chunks should be filtered and the given chunk was excluded explicity\n      if (\n        Array.isArray(excludedChunks) &&\n        excludedChunks.indexOf(chunkName) !== -1\n      ) {\n        return false;\n      }\n\n      // Add otherwise\n      return true;\n    });\n  }\n\n  /**\n   * Helper to sort chunks\n   *\n   * @private\n   * @param {string[]} entryNames\n   * @param {string|((entryNameA: string, entryNameB: string) => number)} sortMode\n   * @param {Compilation} compilation\n   */\n  sortEntryChunks(entryNames, sortMode, compilation) {\n    // Custom function\n    if (typeof sortMode === \"function\") {\n      return entryNames.sort(sortMode);\n    }\n    // Check if the given sort mode is a valid chunkSorter sort mode\n    if (typeof chunkSorter[sortMode] !== \"undefined\") {\n      return chunkSorter[sortMode](entryNames, compilation, this.options);\n    }\n    throw new Error('\"' + sortMode + '\" is not a valid chunk sort mode');\n  }\n\n  /**\n   * Encode each path component using `encodeURIComponent` as files can contain characters\n   * which needs special encoding in URLs like `+ `.\n   *\n   * Valid filesystem characters which need to be encoded for urls:\n   *\n   * # pound, % percent, & ampersand, { left curly bracket, } right curly bracket,\n   * \\ back slash, < left angle bracket, > right angle bracket, * asterisk, ? question mark,\n   * blank spaces, $ dollar sign, ! exclamation point, ' single quotes, \" double quotes,\n   * : colon, @ at sign, + plus sign, ` backtick, | pipe, = equal sign\n   *\n   * However the query string must not be encoded:\n   *\n   *  fo:demonstration-path/very fancy+name.js?path=/home?value=abc&value=def#zzz\n   *    ^             ^    ^    ^     ^    ^  ^    ^^    ^     ^   ^     ^   ^\n   *    |             |    |    |     |    |  |    ||    |     |   |     |   |\n   *    encoded       |    |    encoded    |  |    ||    |     |   |     |   |\n   *                 ignored              ignored  ignored     ignored   ignored\n   *\n   * @private\n   * @param {string} filePath\n   */\n  urlencodePath(filePath) {\n    // People use the filepath in quite unexpected ways.\n    // Try to extract the first querystring of the url:\n    //\n    // some+path/demo.html?value=abc?def\n    //\n    const queryStringStart = filePath.indexOf(\"?\");\n    const urlPath =\n      queryStringStart === -1 ? filePath : filePath.substr(0, queryStringStart);\n    const queryString = filePath.substr(urlPath.length);\n    // Encode all parts except '/' which are not part of the querystring:\n    const encodedUrlPath = urlPath.split(\"/\").map(encodeURIComponent).join(\"/\");\n    return encodedUrlPath + queryString;\n  }\n\n  /**\n   * Appends a cache busting hash to the query string of the url\n   * E.g. http://localhost:8080/ -> http://localhost:8080/?50c9096ba6183fd728eeb065a26ec175\n   *\n   * @private\n   * @param {string | undefined} url\n   * @param {string} hash\n   */\n  appendHash(url, hash) {\n    if (!url) {\n      return url;\n    }\n\n    return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + hash;\n  }\n\n  /**\n   * Generate the relative or absolute base url to reference images, css, and javascript files\n   * from within the html file - the publicPath\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {string} filename\n   * @param {string | 'auto'} customPublicPath\n   * @returns {string}\n   */\n  getPublicPath(compilation, filename, customPublicPath) {\n    /**\n     * @type {string} the configured public path to the asset root\n     * if a path publicPath is set in the current webpack config use it otherwise\n     * fallback to a relative path\n     */\n    const webpackPublicPath = compilation.getAssetPath(\n      /** @type {NonNullable<Compilation[\"outputOptions\"][\"publicPath\"]>} */ (\n        compilation.outputOptions.publicPath\n      ),\n      { hash: compilation.hash },\n    );\n    // Webpack 5 introduced \"auto\" as default value\n    const isPublicPathDefined = webpackPublicPath !== \"auto\";\n\n    let publicPath =\n      // If the html-webpack-plugin options contain a custom public path unset it\n      customPublicPath !== \"auto\"\n        ? customPublicPath\n        : isPublicPathDefined\n          ? // If a hard coded public path exists use it\n            webpackPublicPath\n          : // If no public path was set get a relative url path\n            path\n              .relative(\n                path.resolve(\n                  /** @type {string} */ (compilation.options.output.path),\n                  path.dirname(filename),\n                ),\n                /** @type {string} */ (compilation.options.output.path),\n              )\n              .split(path.sep)\n              .join(\"/\");\n\n    if (publicPath.length && publicPath.substr(-1, 1) !== \"/\") {\n      publicPath += \"/\";\n    }\n\n    return publicPath;\n  }\n\n  /**\n   * The getAssetsForHTML extracts the asset information of a webpack compilation for all given entry names.\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {string} outputName\n   * @param {string[]} entryNames\n   * @returns {AssetsInformationByGroups}\n   */\n  getAssetsInformationByGroups(compilation, outputName, entryNames) {\n    /** The public path used inside the html file */\n    const publicPath = this.getPublicPath(\n      compilation,\n      outputName,\n      this.options.publicPath,\n    );\n    /**\n     * @type {AssetsInformationByGroups}\n     */\n    const assets = {\n      // The public path\n      publicPath,\n      // Will contain all js and mjs files\n      js: [],\n      // Will contain all css files\n      css: [],\n      // Will contain the html5 appcache manifest files if it exists\n      manifest: Object.keys(compilation.assets).find(\n        (assetFile) => path.extname(assetFile) === \".appcache\",\n      ),\n      // Favicon\n      favicon: undefined,\n    };\n\n    // Append a hash for cache busting\n    if (this.options.hash && assets.manifest) {\n      assets.manifest = this.appendHash(\n        assets.manifest,\n        /** @type {string} */ (compilation.hash),\n      );\n    }\n\n    // Extract paths to .js, .mjs and .css files from the current compilation\n    const entryPointPublicPathMap = {};\n    const extensionRegexp = /\\.(css|js|mjs)(\\?|$)/;\n\n    for (let i = 0; i < entryNames.length; i++) {\n      const entryName = entryNames[i];\n      /** entryPointUnfilteredFiles - also includes hot module update files */\n      const entryPointUnfilteredFiles = /** @type {Entrypoint} */ (\n        compilation.entrypoints.get(entryName)\n      ).getFiles();\n      const entryPointFiles = entryPointUnfilteredFiles.filter((chunkFile) => {\n        const asset = compilation.getAsset(chunkFile);\n\n        if (!asset) {\n          return true;\n        }\n\n        // Prevent hot-module files from being included:\n        const assetMetaInformation = asset.info || {};\n\n        return !(\n          assetMetaInformation.hotModuleReplacement ||\n          assetMetaInformation.development\n        );\n      });\n      // Prepend the publicPath and append the hash depending on the\n      // webpack.output.publicPath and hashOptions\n      // E.g. bundle.js -> /bundle.js?hash\n      const entryPointPublicPaths = entryPointFiles.map((chunkFile) => {\n        const entryPointPublicPath = publicPath + this.urlencodePath(chunkFile);\n        return this.options.hash\n          ? this.appendHash(\n              entryPointPublicPath,\n              /** @type {string} */ (compilation.hash),\n            )\n          : entryPointPublicPath;\n      });\n\n      entryPointPublicPaths.forEach((entryPointPublicPath) => {\n        const extMatch = extensionRegexp.exec(\n          /** @type {string} */ (entryPointPublicPath),\n        );\n\n        // Skip if the public path is not a .css, .mjs or .js file\n        if (!extMatch) {\n          return;\n        }\n\n        // Skip if this file is already known\n        // (e.g. because of common chunk optimizations)\n        if (entryPointPublicPathMap[entryPointPublicPath]) {\n          return;\n        }\n\n        entryPointPublicPathMap[entryPointPublicPath] = true;\n\n        // ext will contain .js or .css, because .mjs recognizes as .js\n        const ext = extMatch[1] === \"mjs\" ? \"js\" : extMatch[1];\n\n        assets[ext].push(entryPointPublicPath);\n      });\n    }\n\n    return assets;\n  }\n\n  /**\n   * Once webpack is done with compiling the template into a NodeJS code this function\n   * evaluates it to generate the html result\n   *\n   * The evaluateCompilationResult is only a class function to allow spying during testing.\n   * Please change that in a further refactoring\n   *\n   * @param {string} source\n   * @param {string} publicPath\n   * @param {string} templateFilename\n   * @returns {Promise<string | (() => string | Promise<string>)>}\n   */\n  evaluateCompilationResult(source, publicPath, templateFilename) {\n    if (!source) {\n      return Promise.reject(\n        new Error(\"The child compilation didn't provide a result\"),\n      );\n    }\n\n    // The LibraryTemplatePlugin stores the template result in a local variable.\n    // By adding it to the end the value gets extracted during evaluation\n    if (source.indexOf(\"HTML_WEBPACK_PLUGIN_RESULT\") >= 0) {\n      source += \";\\nHTML_WEBPACK_PLUGIN_RESULT\";\n    }\n\n    const templateWithoutLoaders = templateFilename\n      .replace(/^.+!/, \"\")\n      .replace(/\\?.+$/, \"\");\n    const globalClone = Object.create(\n      Object.getPrototypeOf(global),\n      Object.getOwnPropertyDescriptors(global),\n    );\n    // Presence of `eval` and `Function` breaks template's explicit `eval` call\n    // Ref: https://github.com/nodejs/help/issues/2880\n    delete globalClone.eval;\n    delete globalClone.Function;\n    // Not using `...global` as it throws when localStorage is not explicitly enabled in Node 25+\n    const vmContext = vm.createContext(\n      Object.assign(globalClone, {\n        HTML_WEBPACK_PLUGIN: true,\n        // Copying nonstandard globals like `require` explicitly as they may be absent from `global`\n        require: require,\n        htmlWebpackPluginPublicPath: publicPath,\n        __filename: templateWithoutLoaders,\n        __dirname: path.dirname(templateWithoutLoaders),\n      }),\n    );\n\n    const vmScript = new vm.Script(source, {\n      filename: templateWithoutLoaders,\n    });\n\n    // Evaluate code and cast to string\n    let newSource;\n\n    try {\n      newSource = vmScript.runInContext(vmContext);\n    } catch (e) {\n      return Promise.reject(e);\n    }\n\n    if (\n      typeof newSource === \"object\" &&\n      newSource.__esModule &&\n      newSource.default !== undefined\n    ) {\n      newSource = newSource.default;\n    }\n\n    return typeof newSource === \"string\" || typeof newSource === \"function\"\n      ? Promise.resolve(newSource)\n      : Promise.reject(\n          new Error(\n            'The loader \"' + templateWithoutLoaders + \"\\\" didn't return html.\",\n          ),\n        );\n  }\n\n  /**\n   * Add toString methods for easier rendering inside the template\n   *\n   * @private\n   * @param {Array<HtmlTagObject>} assetTagGroup\n   * @returns {Array<HtmlTagObject>}\n   */\n  prepareAssetTagGroupForRendering(assetTagGroup) {\n    const xhtml = this.options.xhtml;\n    return HtmlTagArray.from(\n      assetTagGroup.map((assetTag) => {\n        const copiedAssetTag = Object.assign({}, assetTag);\n        copiedAssetTag.toString = function () {\n          return htmlTagObjectToString(this, xhtml);\n        };\n        return copiedAssetTag;\n      }),\n    );\n  }\n\n  /**\n   * Generate the template parameters for the template function\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{\n       headTags: HtmlTagObject[],\n       bodyTags: HtmlTagObject[]\n     }} assetTags\n   * @returns {Promise<{[key: any]: any}>}\n   */\n  getTemplateParameters(compilation, assetsInformationByGroups, assetTags) {\n    const templateParameters = this.options.templateParameters;\n\n    if (templateParameters === false) {\n      return Promise.resolve({});\n    }\n\n    if (\n      typeof templateParameters !== \"function\" &&\n      typeof templateParameters !== \"object\"\n    ) {\n      throw new Error(\n        \"templateParameters has to be either a function or an object\",\n      );\n    }\n\n    const templateParameterFunction =\n      typeof templateParameters === \"function\"\n        ? // A custom function can overwrite the entire template parameter preparation\n          templateParameters\n        : // If the template parameters is an object merge it with the default values\n          (compilation, assetsInformationByGroups, assetTags, options) =>\n            Object.assign(\n              {},\n              templateParametersGenerator(\n                compilation,\n                assetsInformationByGroups,\n                assetTags,\n                options,\n              ),\n              templateParameters,\n            );\n    const preparedAssetTags = {\n      headTags: this.prepareAssetTagGroupForRendering(assetTags.headTags),\n      bodyTags: this.prepareAssetTagGroupForRendering(assetTags.bodyTags),\n    };\n    return Promise.resolve().then(() =>\n      templateParameterFunction(\n        compilation,\n        assetsInformationByGroups,\n        preparedAssetTags,\n        this.options,\n      ),\n    );\n  }\n\n  /**\n   * This function renders the actual html by executing the template function\n   *\n   * @private\n   * @param {(templateParameters) => string | Promise<string>} templateFunction\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{\n       headTags: HtmlTagObject[],\n       bodyTags: HtmlTagObject[]\n     }} assetTags\n   * @param {Compilation} compilation\n   * @returns Promise<string>\n   */\n  executeTemplate(\n    templateFunction,\n    assetsInformationByGroups,\n    assetTags,\n    compilation,\n  ) {\n    // Template processing\n    const templateParamsPromise = this.getTemplateParameters(\n      compilation,\n      assetsInformationByGroups,\n      assetTags,\n    );\n\n    return templateParamsPromise.then((templateParams) => {\n      try {\n        // If html is a promise return the promise\n        // If html is a string turn it into a promise\n        return templateFunction(templateParams);\n      } catch (e) {\n        // @ts-ignore\n        compilation.errors.push(new Error(\"Template execution failed: \" + e));\n        return Promise.reject(e);\n      }\n    });\n  }\n\n  /**\n   * Html Post processing\n   *\n   * @private\n   * @param {Compiler} compiler The compiler instance\n   * @param {any} originalHtml The input html\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{headTags: HtmlTagObject[], bodyTags: HtmlTagObject[]}} assetTags The asset tags to inject\n   * @returns {Promise<string>}\n   */\n  postProcessHtml(\n    compiler,\n    originalHtml,\n    assetsInformationByGroups,\n    assetTags,\n  ) {\n    let html = originalHtml;\n\n    if (typeof html !== \"string\") {\n      return Promise.reject(\n        new Error(\n          \"Expected html to be a string but got \" + JSON.stringify(html),\n        ),\n      );\n    }\n\n    if (this.options.inject) {\n      const htmlRegExp = /(<html[^>]*>)/i;\n      const headRegExp = /(<\\/head\\s*>)/i;\n      const bodyRegExp = /(<\\/body\\s*>)/i;\n      const metaViewportRegExp = /<meta[^>]+name=[\"']viewport[\"'][^>]*>/i;\n      const body = assetTags.bodyTags.map((assetTagObject) =>\n        htmlTagObjectToString(assetTagObject, this.options.xhtml),\n      );\n      const head = assetTags.headTags\n        .filter((item) => {\n          if (\n            item.tagName === \"meta\" &&\n            item.attributes &&\n            item.attributes.name === \"viewport\" &&\n            metaViewportRegExp.test(html)\n          ) {\n            return false;\n          }\n\n          return true;\n        })\n        .map((assetTagObject) =>\n          htmlTagObjectToString(assetTagObject, this.options.xhtml),\n        );\n\n      if (body.length) {\n        if (bodyRegExp.test(html)) {\n          // Append assets to body element\n          html = html.replace(bodyRegExp, (match) => body.join(\"\") + match);\n        } else {\n          // Append scripts to the end of the file if no <body> element exists:\n          html += body.join(\"\");\n        }\n      }\n\n      if (head.length) {\n        // Create a head tag if none exists\n        if (!headRegExp.test(html)) {\n          if (!htmlRegExp.test(html)) {\n            html = \"<head></head>\" + html;\n          } else {\n            html = html.replace(htmlRegExp, (match) => match + \"<head></head>\");\n          }\n        }\n\n        // Append assets to head element\n        html = html.replace(headRegExp, (match) => head.join(\"\") + match);\n      }\n\n      // Inject manifest into the opening html tag\n      if (assetsInformationByGroups.manifest) {\n        html = html.replace(/(<html[^>]*)(>)/i, (match, start, end) => {\n          // Append the manifest only if no manifest was specified\n          if (/\\smanifest\\s*=/.test(match)) {\n            return match;\n          }\n          return (\n            start +\n            ' manifest=\"' +\n            assetsInformationByGroups.manifest +\n            '\"' +\n            end\n          );\n        });\n      }\n    }\n\n    // TODO avoid this logic and use https://github.com/webpack-contrib/html-minimizer-webpack-plugin under the hood in the next major version\n    // Check if webpack is running in production mode\n    // @see https://github.com/webpack/webpack/blob/3366421f1784c449f415cda5930a8e445086f688/lib/WebpackOptionsDefaulter.js#L12-L14\n    const isProductionLikeMode =\n      compiler.options.mode === \"production\" || !compiler.options.mode;\n    const needMinify =\n      this.options.minify === true ||\n      typeof this.options.minify === \"object\" ||\n      (this.options.minify === \"auto\" && isProductionLikeMode);\n\n    if (!needMinify) {\n      return Promise.resolve(html);\n    }\n\n    const minifyOptions =\n      typeof this.options.minify === \"object\"\n        ? this.options.minify\n        : {\n            // https://www.npmjs.com/package/html-minifier-terser#options-quick-reference\n            collapseWhitespace: true,\n            keepClosingSlash: true,\n            removeComments: true,\n            removeRedundantAttributes: true,\n            removeScriptTypeAttributes: true,\n            removeStyleLinkTypeAttributes: true,\n            useShortDoctype: true,\n          };\n\n    try {\n      html = require(\"html-minifier-terser\").minify(html, minifyOptions);\n    } catch (e) {\n      const isParseError = String(e.message).indexOf(\"Parse Error\") === 0;\n\n      if (isParseError) {\n        e.message =\n          \"html-webpack-plugin could not minify the generated output.\\n\" +\n          \"In production mode the html minification is enabled by default.\\n\" +\n          \"If you are not generating a valid html output please disable it manually.\\n\" +\n          \"You can do so by adding the following setting to your HtmlWebpackPlugin config:\\n|\\n|\" +\n          \"    minify: false\\n|\\n\" +\n          \"See https://github.com/jantimon/html-webpack-plugin#options for details.\\n\\n\" +\n          \"For parser dedicated bugs please create an issue here:\\n\" +\n          \"https://danielruf.github.io/html-minifier-terser/\" +\n          \"\\n\" +\n          e.message;\n      }\n\n      return Promise.reject(e);\n    }\n\n    return Promise.resolve(html);\n  }\n\n  /**\n   * Helper to return a sorted unique array of all asset files out of the asset object\n   * @private\n   */\n  getAssetFiles(assets) {\n    const files = _uniq(\n      Object.keys(assets)\n        .filter((assetType) => assetType !== \"chunks\" && assets[assetType])\n        .reduce((files, assetType) => files.concat(assets[assetType]), []),\n    );\n    files.sort();\n    return files;\n  }\n\n  /**\n   * Converts a favicon file from disk to a webpack resource and returns the url to the resource\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {string|false} favicon\n   * @param {Compilation} compilation\n   * @param {string} publicPath\n   * @param {PreviousEmittedAssets} previousEmittedAssets\n   * @returns {Promise<string|undefined>}\n   */\n  generateFavicon(\n    compiler,\n    favicon,\n    compilation,\n    publicPath,\n    previousEmittedAssets,\n  ) {\n    if (!favicon) {\n      return Promise.resolve(undefined);\n    }\n\n    const filename = path.resolve(compilation.compiler.context, favicon);\n\n    return promisify(compilation.inputFileSystem.readFile)(filename)\n      .then((buf) => {\n        const source = new compiler.webpack.sources.RawSource(\n          /** @type {string | Buffer} */ (buf),\n          false,\n        );\n        const name = path.basename(filename);\n\n        compilation.fileDependencies.add(filename);\n        compilation.emitAsset(name, source);\n        previousEmittedAssets.push({ name, source });\n\n        const faviconPath = publicPath + name;\n\n        if (this.options.hash) {\n          return this.appendHash(\n            faviconPath,\n            /** @type {string} */ (compilation.hash),\n          );\n        }\n\n        return faviconPath;\n      })\n      .catch(() =>\n        Promise.reject(\n          new Error(\"HtmlWebpackPlugin: could not load file \" + filename),\n        ),\n      );\n  }\n\n  /**\n   * Generate all tags script for the given file paths\n   *\n   * @private\n   * @param {Array<string>} jsAssets\n   * @returns {Array<HtmlTagObject>}\n   */\n  generatedScriptTags(jsAssets) {\n    // @ts-ignore\n    return jsAssets.map((src) => {\n      const attributes = {};\n\n      if (this.options.scriptLoading === \"defer\") {\n        attributes.defer = true;\n      } else if (this.options.scriptLoading === \"module\") {\n        attributes.type = \"module\";\n      } else if (this.options.scriptLoading === \"systemjs-module\") {\n        attributes.type = \"systemjs-module\";\n      }\n\n      attributes.src = src;\n\n      return {\n        tagName: \"script\",\n        voidTag: false,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes,\n      };\n    });\n  }\n\n  /**\n   * Generate all style tags for the given file paths\n   *\n   * @private\n   * @param {Array<string>} cssAssets\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateStyleTags(cssAssets) {\n    return cssAssets.map((styleAsset) => ({\n      tagName: \"link\",\n      voidTag: true,\n      meta: { plugin: \"html-webpack-plugin\" },\n      attributes: {\n        href: styleAsset,\n        rel: \"stylesheet\",\n      },\n    }));\n  }\n\n  /**\n   * Generate an optional base tag\n   *\n   * @param {string | {[attributeName: string]: string}} base\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateBaseTag(base) {\n    return [\n      {\n        tagName: \"base\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        // attributes e.g. { href:\"http://example.com/page.html\" target:\"_blank\" }\n        attributes:\n          typeof base === \"string\"\n            ? {\n                href: base,\n              }\n            : base,\n      },\n    ];\n  }\n\n  /**\n   * Generate all meta tags for the given meta configuration\n   *\n   * @private\n   * @param {false | {[name: string]:  false | string | {[attributeName: string]: string|boolean}}} metaOptions\n   * @returns {Array<HtmlTagObject>}\n   */\n  generatedMetaTags(metaOptions) {\n    if (metaOptions === false) {\n      return [];\n    }\n\n    // Make tags self-closing in case of xhtml\n    // Turn { \"viewport\" : \"width=500, initial-scale=1\" } into\n    // [{ name:\"viewport\" content:\"width=500, initial-scale=1\" }]\n    const metaTagAttributeObjects = Object.keys(metaOptions)\n      .map((metaName) => {\n        const metaTagContent = metaOptions[metaName];\n        return typeof metaTagContent === \"string\"\n          ? {\n              name: metaName,\n              content: metaTagContent,\n            }\n          : metaTagContent;\n      })\n      .filter((attribute) => attribute !== false);\n\n    // Turn [{ name:\"viewport\" content:\"width=500, initial-scale=1\" }] into\n    // the html-webpack-plugin tag structure\n    return metaTagAttributeObjects.map((metaTagAttributes) => {\n      if (metaTagAttributes === false) {\n        throw new Error(\"Invalid meta tag\");\n      }\n      return {\n        tagName: \"meta\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes: metaTagAttributes,\n      };\n    });\n  }\n\n  /**\n   * Generate a favicon tag for the given file path\n   *\n   * @private\n   * @param {string} favicon\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateFaviconTag(favicon) {\n    return [\n      {\n        tagName: \"link\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes: {\n          rel: \"icon\",\n          href: favicon,\n        },\n      },\n    ];\n  }\n\n  /**\n   * Group assets to head and body tags\n   *\n   * @param {{\n      scripts: Array<HtmlTagObject>;\n      styles: Array<HtmlTagObject>;\n      meta: Array<HtmlTagObject>;\n    }} assetTags\n   * @param {\"body\" | \"head\"} scriptTarget\n   * @returns {{\n      headTags: Array<HtmlTagObject>;\n      bodyTags: Array<HtmlTagObject>;\n    }}\n   */\n  groupAssetsByElements(assetTags, scriptTarget) {\n    /** @type {{ headTags: Array<HtmlTagObject>; bodyTags: Array<HtmlTagObject>; }} */\n    const result = {\n      headTags: [...assetTags.meta, ...assetTags.styles],\n      bodyTags: [],\n    };\n\n    // Add script tags to head or body depending on\n    // the htmlPluginOptions\n    if (scriptTarget === \"body\") {\n      result.bodyTags.push(...assetTags.scripts);\n    } else {\n      // If script loading is blocking add the scripts to the end of the head\n      // If script loading is non-blocking add the scripts in front of the css files\n      const insertPosition =\n        this.options.scriptLoading === \"blocking\"\n          ? result.headTags.length\n          : assetTags.meta.length;\n\n      result.headTags.splice(insertPosition, 0, ...assetTags.scripts);\n    }\n\n    return result;\n  }\n\n  /**\n   * Replace [contenthash] in filename\n   *\n   * @see https://survivejs.com/webpack/optimizing/adding-hashes-to-filenames/\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {string} filename\n   * @param {string|Buffer} fileContent\n   * @param {Compilation} compilation\n   * @returns {{ path: string, info: {} }}\n   */\n  replacePlaceholdersInFilename(compiler, filename, fileContent, compilation) {\n    if (/\\[\\\\*([\\w:]+)\\\\*\\]/i.test(filename) === false) {\n      return { path: filename, info: {} };\n    }\n\n    const hash = compiler.webpack.util.createHash(\n      compilation.outputOptions.hashFunction,\n    );\n\n    hash.update(fileContent);\n\n    if (compilation.outputOptions.hashSalt) {\n      hash.update(compilation.outputOptions.hashSalt);\n    }\n\n    const contentHash = /** @type {string} */ (\n      hash\n        .digest(compilation.outputOptions.hashDigest)\n        .slice(0, compilation.outputOptions.hashDigestLength)\n    );\n\n    return compilation.getPathWithInfo(filename, {\n      contentHash,\n      chunk: {\n        hash: contentHash,\n        // @ts-ignore\n        contentHash,\n      },\n    });\n  }\n\n  /**\n   * Function to generate HTML file.\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {Compilation} compilation\n   * @param {string} outputName\n   * @param {CachedChildCompilation} childCompilerPlugin\n   * @param {PreviousEmittedAssets} previousEmittedAssets\n   * @param {{ value: string | undefined }} assetJson\n   * @param {(err?: Error) => void} callback\n   */\n  generateHTML(\n    compiler,\n    compilation,\n    outputName,\n    childCompilerPlugin,\n    previousEmittedAssets,\n    assetJson,\n    callback,\n  ) {\n    // Get all entry point names for this html file\n    const entryNames = Array.from(compilation.entrypoints.keys());\n    const filteredEntryNames = this.filterEntryChunks(\n      entryNames,\n      this.options.chunks,\n      this.options.excludeChunks,\n    );\n    const sortedEntryNames = this.sortEntryChunks(\n      filteredEntryNames,\n      this.options.chunksSortMode,\n      compilation,\n    );\n    const templateResult = this.options.templateContent\n      ? { mainCompilationHash: compilation.hash }\n      : childCompilerPlugin.getCompilationEntryResult(this.options.template);\n\n    if (\"error\" in templateResult) {\n      compilation.errors.push(\n        new Error(\n          prettyError(templateResult.error, compiler.context).toString(),\n        ),\n      );\n    }\n\n    // If the child compilation was not executed during a previous main compile run\n    // it is a cached result\n    const isCompilationCached =\n      templateResult.mainCompilationHash !== compilation.hash;\n    /** Generated file paths from the entry point names */\n    const assetsInformationByGroups = this.getAssetsInformationByGroups(\n      compilation,\n      outputName,\n      sortedEntryNames,\n    );\n    // If the template and the assets did not change we don't have to emit the html\n    const newAssetJson = JSON.stringify(\n      this.getAssetFiles(assetsInformationByGroups),\n    );\n\n    if (\n      isCompilationCached &&\n      this.options.cache &&\n      assetJson.value === newAssetJson\n    ) {\n      previousEmittedAssets.forEach(({ name, source, info }) => {\n        compilation.emitAsset(name, source, info);\n      });\n      return callback();\n    } else {\n      previousEmittedAssets.length = 0;\n      assetJson.value = newAssetJson;\n    }\n\n    // The html-webpack plugin uses a object representation for the html-tags which will be injected\n    // to allow altering them more easily\n    // Just before they are converted a third-party-plugin author might change the order and content\n    const assetsPromise = this.generateFavicon(\n      compiler,\n      this.options.favicon,\n      compilation,\n      assetsInformationByGroups.publicPath,\n      previousEmittedAssets,\n    ).then((faviconPath) => {\n      assetsInformationByGroups.favicon = faviconPath;\n      return HtmlWebpackPlugin.getCompilationHooks(\n        compilation,\n      ).beforeAssetTagGeneration.promise({\n        assets: assetsInformationByGroups,\n        outputName,\n        plugin: this,\n      });\n    });\n\n    // Turn the js and css paths into grouped HtmlTagObjects\n    const assetTagGroupsPromise = assetsPromise\n      // And allow third-party-plugin authors to reorder and change the assetTags before they are grouped\n      .then(({ assets }) =>\n        HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).alterAssetTags.promise({\n          assetTags: {\n            scripts: this.generatedScriptTags(assets.js),\n            styles: this.generateStyleTags(assets.css),\n            meta: [\n              ...(this.options.base !== false\n                ? this.generateBaseTag(this.options.base)\n                : []),\n              ...this.generatedMetaTags(this.options.meta),\n              ...(assets.favicon\n                ? this.generateFaviconTag(assets.favicon)\n                : []),\n            ],\n          },\n          outputName,\n          publicPath: assetsInformationByGroups.publicPath,\n          plugin: this,\n        }),\n      )\n      .then(({ assetTags }) => {\n        // Inject scripts to body unless it set explicitly to head\n        const scriptTarget =\n          this.options.inject === \"head\" ||\n          (this.options.inject !== \"body\" &&\n            this.options.scriptLoading !== \"blocking\")\n            ? \"head\"\n            : \"body\";\n        // Group assets to `head` and `body` tag arrays\n        const assetGroups = this.groupAssetsByElements(assetTags, scriptTarget);\n        // Allow third-party-plugin authors to reorder and change the assetTags once they are grouped\n        return HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).alterAssetTagGroups.promise({\n          headTags: assetGroups.headTags,\n          bodyTags: assetGroups.bodyTags,\n          outputName,\n          publicPath: assetsInformationByGroups.publicPath,\n          plugin: this,\n        });\n      });\n\n    // Turn the compiled template into a nodejs function or into a nodejs string\n    const templateEvaluationPromise = Promise.resolve().then(() => {\n      if (\"error\" in templateResult) {\n        return this.options.showErrors\n          ? prettyError(templateResult.error, compiler.context).toHtml()\n          : \"ERROR\";\n      }\n\n      // Allow to use a custom function / string instead\n      if (this.options.templateContent !== false) {\n        return this.options.templateContent;\n      }\n\n      // Once everything is compiled evaluate the html factory and replace it with its content\n      if (\"compiledEntry\" in templateResult) {\n        const compiledEntry = templateResult.compiledEntry;\n        const assets = compiledEntry.assets;\n\n        // Store assets from child compiler to re-emit them later\n        for (const name in assets) {\n          previousEmittedAssets.push({\n            name,\n            source: assets[name].source,\n            info: assets[name].info,\n          });\n        }\n\n        return this.evaluateCompilationResult(\n          compiledEntry.content,\n          assetsInformationByGroups.publicPath,\n          this.options.template,\n        );\n      }\n\n      return Promise.reject(\n        new Error(\"Child compilation contained no compiledEntry\"),\n      );\n    });\n    const templateExecutionPromise = Promise.all([\n      assetsPromise,\n      assetTagGroupsPromise,\n      templateEvaluationPromise,\n    ])\n      // Execute the template\n      .then(([assetsHookResult, assetTags, compilationResult]) =>\n        typeof compilationResult !== \"function\"\n          ? compilationResult\n          : this.executeTemplate(\n              compilationResult,\n              assetsHookResult.assets,\n              { headTags: assetTags.headTags, bodyTags: assetTags.bodyTags },\n              compilation,\n            ),\n      );\n\n    const injectedHtmlPromise = Promise.all([\n      assetTagGroupsPromise,\n      templateExecutionPromise,\n    ])\n      // Allow plugins to change the html before assets are injected\n      .then(([assetTags, html]) => {\n        const pluginArgs = {\n          html,\n          headTags: assetTags.headTags,\n          bodyTags: assetTags.bodyTags,\n          plugin: this,\n          outputName,\n        };\n        return HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).afterTemplateExecution.promise(pluginArgs);\n      })\n      .then(({ html, headTags, bodyTags }) => {\n        return this.postProcessHtml(compiler, html, assetsInformationByGroups, {\n          headTags,\n          bodyTags,\n        });\n      });\n\n    const emitHtmlPromise = injectedHtmlPromise\n      // Allow plugins to change the html after assets are injected\n      .then((html) => {\n        const pluginArgs = { html, plugin: this, outputName };\n        return HtmlWebpackPlugin.getCompilationHooks(compilation)\n          .beforeEmit.promise(pluginArgs)\n          .then((result) => result.html);\n      })\n      .catch((err) => {\n        // In case anything went wrong the promise is resolved\n        // with the error message and an error is logged\n        compilation.errors.push(\n          new Error(prettyError(err, compiler.context).toString()),\n        );\n        return this.options.showErrors\n          ? prettyError(err, compiler.context).toHtml()\n          : \"ERROR\";\n      })\n      .then((html) => {\n        const filename = outputName.replace(\n          /\\[templatehash([^\\]]*)\\]/g,\n          require(\"util\").deprecate(\n            (match, options) => `[contenthash${options}]`,\n            \"[templatehash] is now [contenthash]\",\n          ),\n        );\n        const replacedFilename = this.replacePlaceholdersInFilename(\n          compiler,\n          filename,\n          html,\n          compilation,\n        );\n        const source = new compiler.webpack.sources.RawSource(html, false);\n\n        // Add the evaluated html code to the webpack assets\n        compilation.emitAsset(\n          replacedFilename.path,\n          source,\n          replacedFilename.info,\n        );\n        previousEmittedAssets.push({ name: replacedFilename.path, source });\n\n        return replacedFilename.path;\n      })\n      .then((finalOutputName) =>\n        HtmlWebpackPlugin.getCompilationHooks(compilation)\n          .afterEmit.promise({\n            outputName: finalOutputName,\n            plugin: this,\n          })\n          .catch((err) => {\n            /** @type {Logger} */\n            (this.logger).error(err);\n            return null;\n          })\n          .then(() => null),\n      );\n\n    // Once all files are added to the webpack compilation\n    // let the webpack compiler continue\n    emitHtmlPromise.then(() => {\n      callback();\n    });\n  }\n}\n\n/**\n * The default for options.templateParameter\n * Generate the template parameters\n *\n * Generate the template parameters for the template function\n * @param {Compilation} compilation\n * @param {AssetsInformationByGroups} assets\n * @param {{\n     headTags: HtmlTagObject[],\n     bodyTags: HtmlTagObject[]\n   }} assetTags\n * @param {ProcessedHtmlWebpackOptions} options\n * @returns {TemplateParameter}\n */\nfunction templateParametersGenerator(compilation, assets, assetTags, options) {\n  return {\n    compilation: compilation,\n    webpackConfig: compilation.options,\n    htmlWebpackPlugin: {\n      tags: assetTags,\n      files: assets,\n      options: options,\n    },\n  };\n}\n\n// Statics:\n/**\n * The major version number of this plugin\n */\nHtmlWebpackPlugin.version = 5;\n\n/**\n * A static helper to get the hooks for this plugin\n *\n * Usage: HtmlWebpackPlugin.getHooks(compilation).HOOK_NAME.tapAsync('YourPluginName', () => { ... });\n */\n// TODO remove me in the next major release in favor getCompilationHooks\nHtmlWebpackPlugin.getHooks = HtmlWebpackPlugin.getCompilationHooks;\nHtmlWebpackPlugin.createHtmlTagObject = createHtmlTagObject;\n\nmodule.exports = HtmlWebpackPlugin;\n"
  },
  {
    "path": "lib/cached-child-compiler.js",
    "content": "// @ts-check\n/**\n * @file\n * Helper plugin manages the cached state of the child compilation\n *\n * To optimize performance the child compilation is running asynchronously.\n * Therefore it needs to be started in the compiler.make phase and ends after\n * the compilation.afterCompile phase.\n *\n * To prevent bugs from blocked hooks there is no promise or event based api\n * for this plugin.\n *\n * Example usage:\n *\n * ```js\n    const childCompilerPlugin = new PersistentChildCompilerPlugin();\n    childCompilerPlugin.addEntry('./src/index.js');\n    compiler.hooks.afterCompile.tapAsync('MyPlugin', (compilation, callback) => {\n      console.log(childCompilerPlugin.getCompilationResult()['./src/index.js']));\n      return true;\n    });\n * ```\n */\n\"use strict\";\n\n// Import types\n/** @typedef {import(\"webpack\").Compiler} Compiler */\n/** @typedef {import(\"webpack\").Compilation} Compilation */\n/** @typedef {import(\"webpack/lib/FileSystemInfo\").Snapshot} Snapshot */\n/** @typedef {import(\"./child-compiler\").ChildCompilationTemplateResult} ChildCompilationTemplateResult */\n/** @typedef {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} FileDependencies */\n/** @typedef {{\n  dependencies: FileDependencies,\n  compiledEntries: {[entryName: string]: ChildCompilationTemplateResult}\n} | {\n  dependencies: FileDependencies,\n  error: Error\n}} ChildCompilationResult */\n\nconst { HtmlWebpackChildCompiler } = require(\"./child-compiler\");\n\n/**\n * This plugin is a singleton for performance reasons.\n * To keep track if a plugin does already exist for the compiler they are cached\n * in this map\n * @type {WeakMap<Compiler, PersistentChildCompilerSingletonPlugin>}}\n */\nconst compilerMap = new WeakMap();\n\nclass CachedChildCompilation {\n  /**\n   * @param {Compiler} compiler\n   */\n  constructor(compiler) {\n    /**\n     * @private\n     * @type {Compiler}\n     */\n    this.compiler = compiler;\n    // Create a singleton instance for the compiler\n    // if there is none\n    if (compilerMap.has(compiler)) {\n      return;\n    }\n    const persistentChildCompilerSingletonPlugin =\n      new PersistentChildCompilerSingletonPlugin();\n    compilerMap.set(compiler, persistentChildCompilerSingletonPlugin);\n    persistentChildCompilerSingletonPlugin.apply(compiler);\n  }\n\n  /**\n   * apply is called by the webpack main compiler during the start phase\n   * @param {string} entry\n   */\n  addEntry(entry) {\n    const persistentChildCompilerSingletonPlugin = compilerMap.get(\n      this.compiler,\n    );\n    if (!persistentChildCompilerSingletonPlugin) {\n      throw new Error(\n        \"PersistentChildCompilerSingletonPlugin instance not found.\",\n      );\n    }\n    persistentChildCompilerSingletonPlugin.addEntry(entry);\n  }\n\n  getCompilationResult() {\n    const persistentChildCompilerSingletonPlugin = compilerMap.get(\n      this.compiler,\n    );\n    if (!persistentChildCompilerSingletonPlugin) {\n      throw new Error(\n        \"PersistentChildCompilerSingletonPlugin instance not found.\",\n      );\n    }\n    return persistentChildCompilerSingletonPlugin.getLatestResult();\n  }\n\n  /**\n   * Returns the result for the given entry\n   * @param {string} entry\n   * @returns {\n      | { mainCompilationHash: string, error: Error }\n      | { mainCompilationHash: string, compiledEntry: ChildCompilationTemplateResult }\n    }\n   */\n  getCompilationEntryResult(entry) {\n    const latestResult = this.getCompilationResult();\n    const compilationResult = latestResult.compilationResult;\n    return \"error\" in compilationResult\n      ? {\n          mainCompilationHash: latestResult.mainCompilationHash,\n          error: compilationResult.error,\n        }\n      : {\n          mainCompilationHash: latestResult.mainCompilationHash,\n          compiledEntry: compilationResult.compiledEntries[entry],\n        };\n  }\n}\n\nclass PersistentChildCompilerSingletonPlugin {\n  /**\n   *\n   * @param {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} fileDependencies\n   * @param {Compilation} mainCompilation\n   * @param {number} startTime\n   */\n  static createSnapshot(fileDependencies, mainCompilation, startTime) {\n    return new Promise((resolve, reject) => {\n      mainCompilation.fileSystemInfo.createSnapshot(\n        startTime,\n        fileDependencies.fileDependencies,\n        fileDependencies.contextDependencies,\n        fileDependencies.missingDependencies,\n        // @ts-ignore\n        null,\n        (err, snapshot) => {\n          if (err) {\n            return reject(err);\n          }\n          resolve(snapshot);\n        },\n      );\n    });\n  }\n\n  /**\n   * Returns true if the files inside this snapshot\n   * have not been changed\n   *\n   * @param {Snapshot} snapshot\n   * @param {Compilation} mainCompilation\n   * @returns {Promise<boolean | undefined>}\n   */\n  static isSnapshotValid(snapshot, mainCompilation) {\n    return new Promise((resolve, reject) => {\n      mainCompilation.fileSystemInfo.checkSnapshotValid(\n        snapshot,\n        (err, isValid) => {\n          if (err) {\n            reject(err);\n          }\n          resolve(isValid);\n        },\n      );\n    });\n  }\n\n  static watchFiles(mainCompilation, fileDependencies) {\n    Object.keys(fileDependencies).forEach((dependencyType) => {\n      fileDependencies[dependencyType].forEach((fileDependency) => {\n        mainCompilation[dependencyType].add(fileDependency);\n      });\n    });\n  }\n\n  constructor() {\n    /**\n     * @private\n     * @type {\n      | {\n        isCompiling: false,\n        isVerifyingCache: false,\n        entries: string[],\n        compiledEntries: string[],\n        mainCompilationHash: string,\n        compilationResult: ChildCompilationResult\n      }\n    | Readonly<{\n      isCompiling: false,\n      isVerifyingCache: true,\n      entries: string[],\n      previousEntries: string[],\n      previousResult: ChildCompilationResult\n    }>\n    | Readonly <{\n      isVerifyingCache: false,\n      isCompiling: true,\n      entries: string[],\n    }>\n  } the internal compilation state */\n    this.compilationState = {\n      isCompiling: false,\n      isVerifyingCache: false,\n      entries: [],\n      compiledEntries: [],\n      mainCompilationHash: \"initial\",\n      compilationResult: {\n        dependencies: {\n          fileDependencies: [],\n          contextDependencies: [],\n          missingDependencies: [],\n        },\n        compiledEntries: {},\n      },\n    };\n  }\n\n  /**\n   * apply is called by the webpack main compiler during the start phase\n   * @param {Compiler} compiler\n   */\n  apply(compiler) {\n    /** @type Promise<ChildCompilationResult> */\n    let childCompilationResultPromise = Promise.resolve({\n      dependencies: {\n        fileDependencies: [],\n        contextDependencies: [],\n        missingDependencies: [],\n      },\n      compiledEntries: {},\n    });\n    /**\n     * The main compilation hash which will only be updated\n     * if the childCompiler changes\n     */\n    /** @type {string} */\n    let mainCompilationHashOfLastChildRecompile = \"\";\n    /** @type {Snapshot | undefined} */\n    let previousFileSystemSnapshot;\n    let compilationStartTime = new Date().getTime();\n\n    compiler.hooks.make.tapAsync(\n      \"PersistentChildCompilerSingletonPlugin\",\n      (mainCompilation, callback) => {\n        if (\n          this.compilationState.isCompiling ||\n          this.compilationState.isVerifyingCache\n        ) {\n          return callback(new Error(\"Child compilation has already started\"));\n        }\n\n        // Update the time to the current compile start time\n        compilationStartTime = new Date().getTime();\n\n        // The compilation starts - adding new templates is now not possible anymore\n        this.compilationState = {\n          isCompiling: false,\n          isVerifyingCache: true,\n          previousEntries: this.compilationState.compiledEntries,\n          previousResult: this.compilationState.compilationResult,\n          entries: this.compilationState.entries,\n        };\n\n        // Validate cache:\n        const isCacheValidPromise = this.isCacheValid(\n          previousFileSystemSnapshot,\n          mainCompilation,\n        );\n\n        let cachedResult = childCompilationResultPromise;\n        childCompilationResultPromise = isCacheValidPromise.then(\n          (isCacheValid) => {\n            // Reuse cache\n            if (isCacheValid) {\n              return cachedResult;\n            }\n            // Start the compilation\n            const compiledEntriesPromise = this.compileEntries(\n              mainCompilation,\n              this.compilationState.entries,\n            );\n            // Update snapshot as soon as we know the fileDependencies\n            // this might possibly cause bugs if files were changed between\n            // compilation start and snapshot creation\n            compiledEntriesPromise\n              .then((childCompilationResult) => {\n                return PersistentChildCompilerSingletonPlugin.createSnapshot(\n                  childCompilationResult.dependencies,\n                  mainCompilation,\n                  compilationStartTime,\n                );\n              })\n              .then((snapshot) => {\n                previousFileSystemSnapshot = snapshot;\n              });\n            return compiledEntriesPromise;\n          },\n        );\n\n        // Add files to compilation which needs to be watched:\n        mainCompilation.hooks.optimizeTree.tapAsync(\n          \"PersistentChildCompilerSingletonPlugin\",\n          (chunks, modules, callback) => {\n            const handleCompilationDonePromise =\n              childCompilationResultPromise.then((childCompilationResult) => {\n                this.watchFiles(\n                  mainCompilation,\n                  childCompilationResult.dependencies,\n                );\n              });\n            handleCompilationDonePromise.then(\n              // @ts-ignore\n              () => callback(null, chunks, modules),\n              callback,\n            );\n          },\n        );\n\n        // Store the final compilation once the main compilation hash is known\n        mainCompilation.hooks.additionalAssets.tapAsync(\n          \"PersistentChildCompilerSingletonPlugin\",\n          (callback) => {\n            const didRecompilePromise = Promise.all([\n              childCompilationResultPromise,\n              cachedResult,\n            ]).then(([childCompilationResult, cachedResult]) => {\n              // Update if childCompilation changed\n              return cachedResult !== childCompilationResult;\n            });\n\n            const handleCompilationDonePromise = Promise.all([\n              childCompilationResultPromise,\n              didRecompilePromise,\n            ]).then(([childCompilationResult, didRecompile]) => {\n              // Update hash and snapshot if childCompilation changed\n              if (didRecompile) {\n                mainCompilationHashOfLastChildRecompile =\n                  /** @type {string} */ (mainCompilation.hash);\n              }\n              this.compilationState = {\n                isCompiling: false,\n                isVerifyingCache: false,\n                entries: this.compilationState.entries,\n                compiledEntries: this.compilationState.entries,\n                compilationResult: childCompilationResult,\n                mainCompilationHash: mainCompilationHashOfLastChildRecompile,\n              };\n            });\n            handleCompilationDonePromise.then(() => callback(null), callback);\n          },\n        );\n\n        // Continue compilation:\n        callback(null);\n      },\n    );\n  }\n\n  /**\n   * Add a new entry to the next compile run\n   * @param {string} entry\n   */\n  addEntry(entry) {\n    if (\n      this.compilationState.isCompiling ||\n      this.compilationState.isVerifyingCache\n    ) {\n      throw new Error(\n        \"The child compiler has already started to compile. \" +\n          \"Please add entries before the main compiler 'make' phase has started or \" +\n          \"after the compilation is done.\",\n      );\n    }\n    if (this.compilationState.entries.indexOf(entry) === -1) {\n      this.compilationState.entries = [...this.compilationState.entries, entry];\n    }\n  }\n\n  getLatestResult() {\n    if (\n      this.compilationState.isCompiling ||\n      this.compilationState.isVerifyingCache\n    ) {\n      throw new Error(\n        \"The child compiler is not done compiling. \" +\n          \"Please access the result after the compiler 'make' phase has started or \" +\n          \"after the compilation is done.\",\n      );\n    }\n    return {\n      mainCompilationHash: this.compilationState.mainCompilationHash,\n      compilationResult: this.compilationState.compilationResult,\n    };\n  }\n\n  /**\n   * Verify that the cache is still valid\n   * @private\n   * @param {Snapshot | undefined} snapshot\n   * @param {Compilation} mainCompilation\n   * @returns {Promise<boolean | undefined>}\n   */\n  isCacheValid(snapshot, mainCompilation) {\n    if (!this.compilationState.isVerifyingCache) {\n      return Promise.reject(\n        new Error(\n          \"Cache validation can only be done right before the compilation starts\",\n        ),\n      );\n    }\n    // If there are no entries we don't need a new child compilation\n    if (this.compilationState.entries.length === 0) {\n      return Promise.resolve(true);\n    }\n    // If there are new entries the cache is invalid\n    if (\n      this.compilationState.entries !== this.compilationState.previousEntries\n    ) {\n      return Promise.resolve(false);\n    }\n    // Mark the cache as invalid if there is no snapshot\n    if (!snapshot) {\n      return Promise.resolve(false);\n    }\n\n    return PersistentChildCompilerSingletonPlugin.isSnapshotValid(\n      snapshot,\n      mainCompilation,\n    );\n  }\n\n  /**\n   * Start to compile all templates\n   *\n   * @private\n   * @param {Compilation} mainCompilation\n   * @param {string[]} entries\n   * @returns {Promise<ChildCompilationResult>}\n   */\n  compileEntries(mainCompilation, entries) {\n    const compiler = new HtmlWebpackChildCompiler(entries);\n    return compiler.compileTemplates(mainCompilation).then(\n      (result) => {\n        return {\n          // The compiled sources to render the content\n          compiledEntries: result,\n          // The file dependencies to find out if a\n          // recompilation is required\n          dependencies: compiler.fileDependencies,\n          // The main compilation hash can be used to find out\n          // if this compilation was done during the current compilation\n          mainCompilationHash: mainCompilation.hash,\n        };\n      },\n      (error) => ({\n        // The compiled sources to render the content\n        error,\n        // The file dependencies to find out if a\n        // recompilation is required\n        dependencies: compiler.fileDependencies,\n        // The main compilation hash can be used to find out\n        // if this compilation was done during the current compilation\n        mainCompilationHash: mainCompilation.hash,\n      }),\n    );\n  }\n\n  /**\n   * @private\n   * @param {Compilation} mainCompilation\n   * @param {FileDependencies} files\n   */\n  watchFiles(mainCompilation, files) {\n    PersistentChildCompilerSingletonPlugin.watchFiles(mainCompilation, files);\n  }\n}\n\nmodule.exports = {\n  CachedChildCompilation,\n};\n"
  },
  {
    "path": "lib/child-compiler.js",
    "content": "// @ts-check\n\"use strict\";\n\n/**\n * @file\n * This file uses webpack to compile a template with a child compiler.\n *\n * [TEMPLATE] -> [JAVASCRIPT]\n *\n */\n\n/** @typedef {import(\"webpack\").Chunk} Chunk */\n/** @typedef {import(\"webpack\").sources.Source} Source */\n/** @typedef {{hash: string, entry: Chunk, content: string, assets: {[name: string]: { source: Source, info: import(\"webpack\").AssetInfo }}}} ChildCompilationTemplateResult */\n\n/**\n * The HtmlWebpackChildCompiler is a helper to allow reusing one childCompiler\n * for multiple HtmlWebpackPlugin instances to improve the compilation performance.\n */\nclass HtmlWebpackChildCompiler {\n  /**\n   *\n   * @param {string[]} templates\n   */\n  constructor(templates) {\n    /**\n     * @type {string[]} templateIds\n     * The template array will allow us to keep track which input generated which output\n     */\n    this.templates = templates;\n    /** @type {Promise<{[templatePath: string]: ChildCompilationTemplateResult}>} */\n    this.compilationPromise; // eslint-disable-line\n    /** @type {number | undefined} */\n    this.compilationStartedTimestamp; // eslint-disable-line\n    /** @type {number | undefined} */\n    this.compilationEndedTimestamp; // eslint-disable-line\n    /**\n     * All file dependencies of the child compiler\n     * @type {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}}\n     */\n    this.fileDependencies = {\n      fileDependencies: [],\n      contextDependencies: [],\n      missingDependencies: [],\n    };\n  }\n\n  /**\n   * Returns true if the childCompiler is currently compiling\n   *\n   * @returns {boolean}\n   */\n  isCompiling() {\n    return !this.didCompile() && this.compilationStartedTimestamp !== undefined;\n  }\n\n  /**\n   * Returns true if the childCompiler is done compiling\n   *\n   * @returns {boolean}\n   */\n  didCompile() {\n    return this.compilationEndedTimestamp !== undefined;\n  }\n\n  /**\n   * This function will start the template compilation\n   * once it is started no more templates can be added\n   *\n   * @param {import('webpack').Compilation} mainCompilation\n   * @returns {Promise<{[templatePath: string]: ChildCompilationTemplateResult}>}\n   */\n  compileTemplates(mainCompilation) {\n    const webpack = mainCompilation.compiler.webpack;\n    const Compilation = webpack.Compilation;\n\n    const NodeTemplatePlugin = webpack.node.NodeTemplatePlugin;\n    const NodeTargetPlugin = webpack.node.NodeTargetPlugin;\n    const LoaderTargetPlugin = webpack.LoaderTargetPlugin;\n    const EntryPlugin = webpack.EntryPlugin;\n\n    // To prevent multiple compilations for the same template\n    // the compilation is cached in a promise.\n    // If it already exists return\n    if (this.compilationPromise) {\n      return this.compilationPromise;\n    }\n\n    const outputOptions = {\n      filename: \"__child-[name]\",\n      publicPath: \"\",\n      library: {\n        type: \"var\",\n        name: \"HTML_WEBPACK_PLUGIN_RESULT\",\n      },\n      scriptType: /** @type {'text/javascript'} */ (\"text/javascript\"),\n      iife: true,\n    };\n    const compilerName = \"HtmlWebpackCompiler\";\n    // Create an additional child compiler which takes the template\n    // and turns it into an Node.JS html factory.\n    // This allows us to use loaders during the compilation\n    const childCompiler = mainCompilation.createChildCompiler(\n      compilerName,\n      outputOptions,\n      [\n        // Compile the template to nodejs javascript\n        new NodeTargetPlugin(),\n        new NodeTemplatePlugin(),\n        new LoaderTargetPlugin(\"node\"),\n        new webpack.library.EnableLibraryPlugin(\"var\"),\n      ],\n    );\n    // The file path context which webpack uses to resolve all relative files to\n    childCompiler.context = mainCompilation.compiler.context;\n\n    // Generate output file names\n    const temporaryTemplateNames = this.templates.map(\n      (template, index) => `__child-HtmlWebpackPlugin_${index}-${template}`,\n    );\n\n    // Add all templates\n    this.templates.forEach((template, index) => {\n      new EntryPlugin(\n        childCompiler.context,\n        \"data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;\",\n        `HtmlWebpackPlugin_${index}-${template}`,\n      ).apply(childCompiler);\n      new EntryPlugin(\n        childCompiler.context,\n        template,\n        `HtmlWebpackPlugin_${index}-${template}`,\n      ).apply(childCompiler);\n    });\n\n    // The templates are compiled and executed by NodeJS - similar to server side rendering\n    // Unfortunately this causes issues as some loaders require an absolute URL to support ES Modules\n    // The following config enables relative URL support for the child compiler\n    childCompiler.options.module = { ...childCompiler.options.module };\n    childCompiler.options.module.parser = {\n      ...childCompiler.options.module.parser,\n    };\n    childCompiler.options.module.parser.javascript = {\n      ...childCompiler.options.module.parser.javascript,\n      url: \"relative\",\n    };\n\n    this.compilationStartedTimestamp = new Date().getTime();\n    /** @type {Promise<{[templatePath: string]: ChildCompilationTemplateResult}>} */\n    this.compilationPromise = new Promise((resolve, reject) => {\n      /** @type {Source[]} */\n      const extractedAssets = [];\n\n      childCompiler.hooks.thisCompilation.tap(\n        \"HtmlWebpackPlugin\",\n        (compilation) => {\n          compilation.hooks.processAssets.tap(\n            {\n              name: \"HtmlWebpackPlugin\",\n              stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n            },\n            (assets) => {\n              temporaryTemplateNames.forEach((temporaryTemplateName) => {\n                if (assets[temporaryTemplateName]) {\n                  extractedAssets.push(assets[temporaryTemplateName]);\n\n                  compilation.deleteAsset(temporaryTemplateName);\n                }\n              });\n            },\n          );\n        },\n      );\n\n      childCompiler.runAsChild((err, entries, childCompilation) => {\n        // Extract templates\n        // TODO fine a better way to store entries and results, to avoid duplicate chunks and assets\n        const compiledTemplates = entries\n          ? extractedAssets.map((asset) => asset.source())\n          : [];\n\n        // Extract file dependencies\n        if (entries && childCompilation) {\n          this.fileDependencies = {\n            fileDependencies: Array.from(childCompilation.fileDependencies),\n            contextDependencies: Array.from(\n              childCompilation.contextDependencies,\n            ),\n            missingDependencies: Array.from(\n              childCompilation.missingDependencies,\n            ),\n          };\n        }\n\n        // Reject the promise if the childCompilation contains error\n        if (\n          childCompilation &&\n          childCompilation.errors &&\n          childCompilation.errors.length\n        ) {\n          const errorDetailsArray = [];\n          for (const error of childCompilation.errors) {\n            let message = error.message;\n            if (error.stack) {\n              message += \"\\n\" + error.stack;\n            }\n            errorDetailsArray.push(message);\n          }\n          const errorDetails = errorDetailsArray.join(\"\\n\");\n\n          reject(new Error(\"Child compilation failed:\\n\" + errorDetails));\n\n          return;\n        }\n\n        // Reject if the error object contains errors\n        if (err) {\n          reject(err);\n          return;\n        }\n\n        if (!childCompilation || !entries) {\n          reject(new Error(\"Empty child compilation\"));\n          return;\n        }\n\n        /**\n         * @type {{[templatePath: string]: ChildCompilationTemplateResult}}\n         */\n        const result = {};\n\n        /** @type {{[name: string]: { source: Source, info: import(\"webpack\").AssetInfo }}} */\n        const assets = {};\n\n        for (const asset of childCompilation.getAssets()) {\n          assets[asset.name] = { source: asset.source, info: asset.info };\n        }\n\n        compiledTemplates.forEach((templateSource, entryIndex) => {\n          // The compiledTemplates are generated from the entries added in\n          // the addTemplate function.\n          // Therefore, the array index of this.templates should be the as entryIndex.\n          result[this.templates[entryIndex]] = {\n            // TODO, can we have Buffer here?\n            content: /** @type {string} */ (templateSource),\n            hash: childCompilation.hash || \"XXXX\",\n            entry: entries[entryIndex],\n            assets,\n          };\n        });\n\n        this.compilationEndedTimestamp = new Date().getTime();\n\n        resolve(result);\n      });\n    });\n\n    return this.compilationPromise;\n  }\n}\n\nmodule.exports = {\n  HtmlWebpackChildCompiler,\n};\n"
  },
  {
    "path": "lib/chunksorter.js",
    "content": "// @ts-check\n\"use strict\";\n\n/** @typedef {import(\"webpack\").Compilation} Compilation */\n\n/**\n * @type {{[sortmode: string] : (entryPointNames: Array<string>, compilation: Compilation, htmlWebpackPluginOptions: any) => Array<string> }}\n * This file contains different sort methods for the entry chunks names\n */\nmodule.exports = {};\n\n/**\n * Performs identity mapping (no-sort).\n * @param  {Array<string>} chunks the chunks to sort\n * @return {Array<string>} The sorted chunks\n */\nmodule.exports.none = (chunks) => chunks;\n\n/**\n * Sort manually by the chunks\n * @param {string[]} entryPointNames the chunks to sort\n * @param {Compilation} compilation the webpack compilation\n * @param {any} htmlWebpackPluginOptions the plugin options\n * @return {string[]} The sorted chunks\n */\nmodule.exports.manual = (\n  entryPointNames,\n  compilation,\n  htmlWebpackPluginOptions,\n) => {\n  const chunks = htmlWebpackPluginOptions.chunks;\n  if (!Array.isArray(chunks)) {\n    return entryPointNames;\n  }\n  // Remove none existing entries from\n  // htmlWebpackPluginOptions.chunks\n  return chunks.filter((entryPointName) => {\n    return compilation.entrypoints.has(entryPointName);\n  });\n};\n\n/**\n * Defines the default sorter.\n */\nmodule.exports.auto = module.exports.none;\n"
  },
  {
    "path": "lib/errors.js",
    "content": "// @ts-nocheck\n\"use strict\";\n\nlet prettyError;\n\nfunction getPrettyError() {\n  if (!prettyError) {\n    // lazily require to improve startup time since pretty-error is rather heavy package\n    const PrettyError = require(\"pretty-error\");\n    prettyError = new PrettyError();\n    prettyError.withoutColors();\n    prettyError.skipPackage(\"html-plugin-evaluation\");\n    prettyError.skipNodeFiles();\n    prettyError.skip(function (traceLine) {\n      return traceLine.path === \"html-plugin-evaluation\";\n    });\n  }\n  return prettyError;\n}\n\nmodule.exports = function (err, context) {\n  return {\n    toHtml: function () {\n      return \"Html Webpack Plugin:\\n<pre>\\n\" + this.toString() + \"</pre>\";\n    },\n    toJsonHtml: function () {\n      return JSON.stringify(this.toHtml());\n    },\n    toString: function () {\n      try {\n        return getPrettyError()\n          .render(err)\n          .replace(/webpack:\\/\\/\\/\\./g, context);\n      } catch (e) {\n        // This can sometimes fail. We don't know why, but returning the\n        // original error is better than returning the error thrown by\n        // pretty-error.\n        return err;\n      }\n    },\n  };\n};\n"
  },
  {
    "path": "lib/hooks.js",
    "content": "// TODO remove in the next major release\nconst plugin = require(\"../index\");\n\nmodule.exports = {\n  getHtmlWebpackPluginHooks: (compilation) =>\n    plugin.getCompilationHooks(compilation),\n};\n"
  },
  {
    "path": "lib/html-tags.js",
    "content": "// @ts-check\n/** @typedef {import(\"../typings\").HtmlTagObject} HtmlTagObject */\n/**\n * @file\n * This file provides to helper to create html as a object representation as\n * those objects are easier to modify than pure string representations\n *\n * Usage:\n * ```\n * const element = createHtmlTagObject('h1', {class: 'demo'}, 'Hello World');\n * const html = htmlTagObjectToString(element);\n * console.log(html) // -> <h1 class=\"demo\">Hello World</h1>\n * ```\n */\n\n/**\n * All html tag elements which must not contain innerHTML\n * @see https://www.w3.org/TR/html5/syntax.html#void-elements\n */\nconst voidTags = [\n  \"area\",\n  \"base\",\n  \"br\",\n  \"col\",\n  \"embed\",\n  \"hr\",\n  \"img\",\n  \"input\",\n  \"keygen\",\n  \"link\",\n  \"meta\",\n  \"param\",\n  \"source\",\n  \"track\",\n  \"wbr\",\n];\n\n/**\n * Turn a tag definition into a html string\n * @param {HtmlTagObject} tagDefinition\n *  A tag element according to the htmlWebpackPlugin object notation\n *\n * @param xhtml {boolean}\n *   Whether the generated html should add closing slashes to be xhtml compliant\n */\nfunction htmlTagObjectToString(tagDefinition, xhtml) {\n  const attributes = Object.keys(tagDefinition.attributes || {})\n    .filter(function (attributeName) {\n      return (\n        tagDefinition.attributes[attributeName] === \"\" ||\n        tagDefinition.attributes[attributeName]\n      );\n    })\n    .map(function (attributeName) {\n      if (tagDefinition.attributes[attributeName] === true) {\n        return xhtml\n          ? attributeName + '=\"' + attributeName + '\"'\n          : attributeName;\n      }\n      return (\n        attributeName + '=\"' + tagDefinition.attributes[attributeName] + '\"'\n      );\n    });\n  return (\n    \"<\" +\n    [tagDefinition.tagName].concat(attributes).join(\" \") +\n    (tagDefinition.voidTag && xhtml ? \"/\" : \"\") +\n    \">\" +\n    (tagDefinition.innerHTML || \"\") +\n    (tagDefinition.voidTag ? \"\" : \"</\" + tagDefinition.tagName + \">\")\n  );\n}\n\n/**\n * Static helper to create a tag object to be get injected into the dom\n *\n * @param {string} tagName\n * the name of the tag e.g. 'div'\n *\n * @param {{[attributeName: string]: string|boolean|null|undefined}} [attributes]\n * tag attributes e.g. `{ 'class': 'example', disabled: true }`\n *\n * @param {string} [innerHTML]\n *\n * @param {{[attributeName: string]: string|boolean|null|undefined}} [meta]\n * meta information about the tag e.g. `{ 'plugin': 'html-webpack-plugin' }`\n *\n * @returns {HtmlTagObject}\n */\nfunction createHtmlTagObject(tagName, attributes, innerHTML, meta) {\n  return {\n    tagName: tagName,\n    voidTag: voidTags.indexOf(tagName) !== -1,\n    attributes: attributes || {},\n    meta: meta || {},\n    innerHTML: innerHTML,\n  };\n}\n\n/**\n * The `HtmlTagArray Array with a custom `.toString()` method.\n *\n * This allows the following:\n * ```\n *   const tags = HtmlTagArray.from([tag1, tag2]);\n *   const scriptTags = tags.filter((tag) => tag.tagName === 'script');\n *   const html = scriptTags.toString();\n * ```\n *\n * Or inside a string literal:\n * ```\n *   const tags = HtmlTagArray.from([tag1, tag2]);\n *   const html = `<html><body>${tags.filter((tag) => tag.tagName === 'script')}</body></html>`;\n * ```\n *\n */\nclass HtmlTagArray extends Array {\n  toString() {\n    return this.join(\"\");\n  }\n}\n\nmodule.exports = {\n  HtmlTagArray: HtmlTagArray,\n  createHtmlTagObject: createHtmlTagObject,\n  htmlTagObjectToString: htmlTagObjectToString,\n};\n"
  },
  {
    "path": "lib/loader.js",
    "content": "/* This loader renders the template with underscore if no other loader was found */\n// @ts-nocheck\n\"use strict\";\nconst _template = require(\"lodash/template\");\n\nmodule.exports = function (source) {\n  // Get templating options\n  const options = this.getOptions();\n  const force = options.force || false;\n\n  const allLoadersButThisOne = this.loaders.filter(\n    (loader) => loader.normal !== module.exports,\n  );\n\n  // This loader shouldn't kick in if there is any other loader (unless it's explicitly enforced)\n  if (allLoadersButThisOne.length > 0 && !force) {\n    return source;\n  }\n\n  // Allow only one html-webpack-plugin loader to allow loader options in the webpack config\n  const htmlWebpackPluginLoaders = this.loaders.filter(\n    (loader) => loader.normal === module.exports,\n  );\n  const lastHtmlWebpackPluginLoader =\n    htmlWebpackPluginLoaders[htmlWebpackPluginLoaders.length - 1];\n  if (this.loaders[this.loaderIndex] !== lastHtmlWebpackPluginLoader) {\n    return source;\n  }\n\n  // Skip .js files (unless it's explicitly enforced)\n  if (/\\.(c|m)?js$/.test(this.resourcePath) && !force) {\n    return source;\n  }\n\n  // The following part renders the template with lodash as a minimalistic loader\n  //\n  const template = _template(source, {\n    interpolate: /<%=([\\s\\S]+?)%>/g,\n    variable: \"data\",\n    ...options,\n  });\n  // Use `eval(\"require\")(\"lodash\")` to enforce using the native nodejs require\n  // during template execution\n  return (\n    'var _ = eval(\"require\")(' +\n    JSON.stringify(require.resolve(\"lodash\")) +\n    \");\" +\n    \"module.exports = function (templateParams) { with(templateParams) {\" +\n    // Execute the lodash template\n    \"return (\" +\n    template.source +\n    \")();\" +\n    \"}}\"\n  );\n};\n"
  },
  {
    "path": "lint-staged.config.js",
    "content": "module.exports = {\n  \"*\": [\n    \"prettier --cache --write --ignore-unknown\",\n    \"cspell --cache --no-must-find-files\",\n  ],\n  \"*.js\": [\"eslint --cache --fix\"],\n};\n"
  },
  {
    "path": "logs",
    "content": "<i> [webpack-dev-server] Project is running at:\n<i> [webpack-dev-server] Loopback: http://localhost:8080/\n<i> [webpack-dev-server] On Your Network (IPv4): http://172.20.10.2:8080/\n<i> [webpack-dev-server] Content not from webpack is served from '/home/akait/IdeaProjects/html-webpack-plugin/dist' directory\n/home/akait/IdeaProjects/html-webpack-plugin/node_modules/image-minimizer-webpack-plugin/dist/loader.js:43\n  loaderContext.request = request.replace(\".png\", \".webp\");\n                          ^\n\nReferenceError: request is not defined\n    at changeResource (/home/akait/IdeaProjects/html-webpack-plugin/node_modules/image-minimizer-webpack-plugin/dist/loader.js:43:27)\n    at Object.loader (/home/akait/IdeaProjects/html-webpack-plugin/node_modules/image-minimizer-webpack-plugin/dist/loader.js:191:5)\n\nNode.js v18.15.0\n"
  },
  {
    "path": "migration.md",
    "content": "# Migrating from 1.x to 2.x\n\n## Default config\n\nhttps://github.com/ampedandwired/html-webpack-plugin/tree/master/examples/default\n\nAs of 2.x the `inject` options is set to true by default which means that all your javascript, css files and manifest files are injected automatically. See https://github.com/ampedandwired/html-webpack-plugin#configuration\n\nThe default template has changed according to the inject option - but should behave like the previous version did.\n\n```js\nvar HtmlWebpackPlugin = require(\"html-webpack-plugin\");\n\nmodule.exports = {\n  // ...\n  plugins: [new HtmlWebpackPlugin()],\n};\n```\n\n## Custom template\n\nThis inject feature aims to simplify your custom templates:\nhttps://github.com/ampedandwired/html-webpack-plugin/tree/master/examples/custom-template\n\n```js\nvar HtmlWebpackPlugin = require(\"html-webpack-plugin\");\n\nmodule.exports = {\n  // ...\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.html\",\n    }),\n  ],\n};\n```\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Webpack App</title>\n  </head>\n  <body></body>\n</html>\n```\n\nAlthough we did not specify any script tags or link tags they will be injected automatically and the result will be:\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Webpack App</title>\n    <link href=\"styles.css\" rel=\"stylesheet\" />\n  </head>\n  <body>\n    <script src=\"bundle.js\"></script>\n  </body>\n</html>\n```\n\n## Templating and variables\n\nAs of 2.x blueimp was replaced by lodash/underscore/ejs templates as they are more common.\nThis also removes the `o` in template variables. ` <body class=\"{%= o.htmlWebpackPlugin.options.environment %}\">` becomes `<body class=\"<%= htmlWebpackPlugin.options.environment %>\">` it also allows to escape variables by using `<%-` instead of `<%=` to prevent unexpected behaviours: `<body class=\"<%- htmlWebpackPlugin.options.environment %>\">`\n\n# Loaders in templates\n\nLoaders may now be used inside the template the same way as you would expect in your javascript files.\n\n```html\n<link\n  rel=\"apple-touch-icon\"\n  href=\"<%- require('../images/favicons/apple-icon-60x60.png') %>\"\n/>\n<%= require('partial.html') %>\n```\n\nFor the above example you would have to configure a [html](https://github.com/webpack/html-loader) and url/[file-loader](https://github.com/webpack/file-loader):\n\n```js\nmodule: {\n  rules: [\n    { test: /\\.png$/, type: \"asset/resource\" },\n    {\n      test: /\\.html$/,\n      exclude: /index\\.html$/, // you need to exclude your base template (unless you do not want this plugin own templating feature)\n      loader: \"html\",\n    },\n  ];\n}\n```\n\nThis configuration allows you to require partial html from your main `index.html` without being itself parsed by the html-loader instead of this html-webpack-plugin.\n\n## Custom template engines\n\nMaybe you prefer pug or blueimp over underscore - or your project is using pug for the front end part.\nWith 2.x you can use the webpack loaders either once only for the template as in the following example\nwhere we use pug (requires the [pug-loader](https://github.com/webpack/pug-loader)):\n\n```js\nvar HtmlWebpackPlugin = require(\"html-webpack-plugin\");\n\nmodule.exports = {\n  // ...\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"pug-loader!template.pug\",\n    }),\n  ],\n};\n```\n\nor by configuring webpack to handle all `.pug` files:\n\n```js\nmodule.exports = {\n  // ...\n  module: {\n    rules: [{ test: /\\.pug$/, loader: \"pug-loader\" }],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.pug\",\n    }),\n  ],\n};\n```\n\nPlease note that if you specify the loader and use 'pug!template.pug' webpack will try to apply the pug loader twice and fail.\n\n## Isomorph apps\n\nAs of the loader changes in 2.x the `templateContent` was removed.\nHowever you can still use custom javascript functions to generate a template:\n\n```js\nmodule.exports = {\n  // ...\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: \"template.js\",\n    }),\n  ],\n};\n```\n\nSimple template.js\n\n```js\nmodule.exports = \"<html>...</html>\";\n```\n\nMore advanced template.js\n\n```js\nmodule.exports = function (templateParams) {\n  return \"<html>..</html>\";\n};\n```\n\nUsing loaders inside a template.js\n\n```js\n// This function has to return a string or promised string:\nmodule.exports = function (templateParams) {\n  // Play around with the arguments and then use the webpack pug loader to load the pug:\n  return require(\"./template.pug\")({\n    assets: templateParams.htmlWebpackPlugin.files,\n  });\n};\n```\n\nUnfortunately `__dirname` does not work correctly.\nIf someone knows why I would love to merge a pull request.\nA good starting point might be here: https://github.com/webpack/webpack/issues/135\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"html-webpack-plugin\",\n  \"version\": \"5.6.6\",\n  \"license\": \"MIT\",\n  \"description\": \"Simplifies creation of HTML files to serve your webpack bundles\",\n  \"author\": \"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)\",\n  \"main\": \"index.js\",\n  \"types\": \"typings.d.ts\",\n  \"files\": [\n    \"lib/\",\n    \"index.js\",\n    \"default_index.ejs\",\n    \"typings.d.ts\"\n  ],\n  \"scripts\": {\n    \"posttest\": \"tsc\",\n    \"puml\": \"npx puml generate flow.puml -o flow.png\",\n    \"build-examples\": \"node examples/build-examples.js\",\n    \"commitlint\": \"commitlint --from=master\",\n    \"security\": \"npm audit --omit=dev\",\n    \"lint:prettier\": \"prettier --cache --list-different .\",\n    \"lint:js\": \"eslint --cache .\",\n    \"lint:spelling\": \"cspell --cache --no-must-find-files --quiet \\\"**/*.*\\\"\",\n    \"lint\": \"npm-run-all -l -p \\\"lint:**\\\"\",\n    \"fix:js\": \"npm run lint:js -- --fix\",\n    \"fix:prettier\": \"npm run lint:prettier -- --write\",\n    \"fix\": \"npm-run-all -l fix:js fix:prettier\",\n    \"test:only\": \"cross-env NODE_ENV=test jest\",\n    \"test:watch\": \"npm run test:only -- --watch\",\n    \"test:manual\": \"npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js\",\n    \"test:coverage\": \"npm run test:only -- --coverage\",\n    \"pretest\": \"npm run lint\",\n    \"test\": \"npm run test:coverage\",\n    \"prepare\": \"husky\",\n    \"release\": \"standard-version\"\n  },\n  \"devDependencies\": {\n    \"@commitlint/cli\": \"^18.4.4\",\n    \"@commitlint/config-conventional\": \"^18.4.4\",\n    \"@types/node\": \"^20.2.5\",\n    \"cross-env\": \"^7.0.3\",\n    \"cspell\": \"^8.3.2\",\n    \"css-loader\": \"5.0.1\",\n    \"cz-conventional-changelog\": \"2.1.0\",\n    \"dir-compare\": \"^3.3.0\",\n    \"eslint\": \"^8.56.0\",\n    \"handlebars-loader\": \"^1.7.3\",\n    \"html-loader\": \"2.1.1\",\n    \"husky\": \"^9.0.10\",\n    \"jest\": \"^27.2.5\",\n    \"lint-staged\": \"^15.2.2\",\n    \"mini-css-extract-plugin\": \"^1.6.0\",\n    \"npm-run-all\": \"^4.1.5\",\n    \"prettier\": \"^3.2.5\",\n    \"pug\": \"3.0.2\",\n    \"pug-loader\": \"2.4.0\",\n    \"raw-loader\": \"4.0.2\",\n    \"rimraf\": \"2.6.3\",\n    \"standard-version\": \"^9.3.0\",\n    \"style-loader\": \"2.0.0\",\n    \"typescript\": \"4.9.4\",\n    \"webpack\": \"^5.104.1\",\n    \"webpack-cli\": \"4.5.0\",\n    \"webpack-recompilation-simulator\": \"3.2.0\"\n  },\n  \"dependencies\": {\n    \"@types/html-minifier-terser\": \"^6.0.0\",\n    \"html-minifier-terser\": \"^6.0.2\",\n    \"lodash\": \"^4.17.21\",\n    \"pretty-error\": \"^4.0.0\",\n    \"tapable\": \"^2.0.0\"\n  },\n  \"peerDependencies\": {\n    \"@rspack/core\": \"0.x || 1.x\",\n    \"webpack\": \"^5.20.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@rspack/core\": {\n      \"optional\": true\n    },\n    \"webpack\": {\n      \"optional\": true\n    }\n  },\n  \"keywords\": [\n    \"webpack\",\n    \"plugin\",\n    \"html\",\n    \"html-webpack-plugin\"\n  ],\n  \"bugs\": \"https://github.com/jantimon/html-webpack-plugin/issues\",\n  \"homepage\": \"https://github.com/jantimon/html-webpack-plugin\",\n  \"repository\": \"https://github.com/jantimon/html-webpack-plugin.git\",\n  \"engines\": {\n    \"node\": \">=10.13.0\"\n  },\n  \"jest\": {\n    \"watchPathIgnorePatterns\": [\n      \"<rootDir>/dist\"\n    ],\n    \"testEnvironment\": \"node\"\n  },\n  \"funding\": {\n    \"type\": \"opencollective\",\n    \"url\": \"https://opencollective.com/html-webpack-plugin\"\n  }\n}\n"
  },
  {
    "path": "spec/basic.spec.js",
    "content": "/*\n * Integration and unit tests for all features but caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst fs = require(\"fs\");\nconst webpack = require(\"webpack\");\nconst rimraf = require(\"rimraf\");\nconst _extend = require(\"lodash/extend\");\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst webpackMajorVersion = Number(\n  require(\"webpack/package.json\").version.split(\".\")[0],\n);\nconst itUnixOnly =\n  process.platform === \"win32\" || process.platform === \"win64\" ? it.skip : it;\n\nif (isNaN(webpackMajorVersion)) {\n  throw new Error(\"Cannot parse webpack major version\");\n}\n\nconst HtmlWebpackPlugin = require(\"../index.js\");\n\nconst OUTPUT_DIR = path.resolve(__dirname, \"../dist/basic-spec\");\n\njest.setTimeout(30000);\nprocess.on(\"unhandledRejection\", (r) => console.log(r));\n\nfunction testHtmlPlugin(\n  webpackConfig,\n  expectedResults,\n  outputFile,\n  done,\n  expectErrors,\n  expectWarnings,\n) {\n  outputFile = outputFile || \"index.html\";\n  webpack(webpackConfig, (err, stats) => {\n    expect(err).toBeFalsy();\n    const compilationErrors = (stats.compilation.errors || []).join(\"\\n\");\n    if (expectErrors) {\n      expect(compilationErrors).not.toBe(\"\");\n    } else {\n      expect(compilationErrors).toBe(\"\");\n    }\n    const compilationWarnings = (stats.compilation.warnings || []).join(\"\\n\");\n    if (expectWarnings) {\n      expect(compilationWarnings).not.toBe(\"\");\n    } else {\n      expect(compilationWarnings).toBe(\"\");\n    }\n    if (outputFile instanceof RegExp) {\n      const fileNames = Object.keys(stats.compilation.assets);\n      const matches = Object.keys(stats.compilation.assets).filter((item) =>\n        outputFile.test(item),\n      );\n      expect(matches[0] || fileNames).not.toEqual(fileNames);\n      outputFile = matches[0];\n    }\n    expect(outputFile.indexOf(\"[hash]\") === -1).toBe(true);\n    const outputFileExists = fs.existsSync(path.join(OUTPUT_DIR, outputFile));\n    expect(outputFileExists).toBe(true);\n    if (!outputFileExists) {\n      return done();\n    }\n    const htmlContent = fs\n      .readFileSync(path.join(OUTPUT_DIR, outputFile))\n      .toString();\n    let chunksInfo;\n    for (let i = 0; i < expectedResults.length; i++) {\n      const expectedResult = expectedResults[i];\n      if (expectedResult instanceof RegExp) {\n        expect(htmlContent).toMatch(expectedResult);\n      } else if (typeof expectedResult === \"object\") {\n        if (expectedResult.type === \"chunkhash\") {\n          if (!chunksInfo) {\n            chunksInfo = getChunksInfoFromStats(stats);\n          }\n          const chunkhash = chunksInfo[expectedResult.chunkName].hash;\n          expect(htmlContent).toContain(\n            expectedResult.containStr.replace(\"%chunkhash%\", chunkhash),\n          );\n        }\n      } else {\n        expect(htmlContent).toContain(\n          expectedResult.replace(\"%hash%\", stats.hash),\n        );\n      }\n    }\n    done();\n  });\n}\n\nfunction getChunksInfoFromStats(stats) {\n  const chunks = stats.compilation.getStats().toJson().chunks;\n  const chunksInfo = {};\n  for (let i = 0; i < chunks.length; i++) {\n    const chunk = chunks[i];\n    const chunkName = chunk.names[0];\n    if (chunkName) {\n      chunksInfo[chunkName] = chunk;\n    }\n  }\n  return chunksInfo;\n}\n\ndescribe(\"HtmlWebpackPlugin\", () => {\n  beforeEach((done) => {\n    rimraf(OUTPUT_DIR, done);\n  });\n\n  it(\"generates a default index.html file for a single entry point\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [/<script defer=\"defer\" src=\"index_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      done,\n    );\n  });\n\n  it(\"properly encodes file names in emitted URIs\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"foo/very fancy+name.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        /<script defer=\"defer\" src=\"foo\\/very%20fancy%2Bname.js\"><\\/script>[\\s]*<\\/head>/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  itUnixOnly(\n    \"properly encodes file names in emitted URIs but keeps the querystring\",\n    (done) => {\n      testHtmlPlugin(\n        {\n          mode: \"production\",\n          entry: path.join(__dirname, \"fixtures/index.js\"),\n          output: {\n            path: OUTPUT_DIR,\n            filename:\n              \"fo:o/very fancy+file-name.js?path=/home?value=abc&value=def#zzz\",\n          },\n          plugins: [new HtmlWebpackPlugin()],\n        },\n        [\n          '<script defer=\"defer\" src=\"fo%3Ao/very%20fancy%2Bfile-name.js?path=/home?value=abc&value=def#zzz\">',\n        ],\n        null,\n        done,\n      );\n    },\n  );\n\n  it(\"generates a default index.html file with multiple entry points\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        '<script defer=\"defer\" src=\"util_bundle.js\"',\n        '<script defer=\"defer\" src=\"app_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to specify a custom loader without injection\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template:\n              \"pug-loader!\" + path.join(__dirname, \"fixtures/template.pug\"),\n          }),\n        ],\n      },\n      ['<script src=\"app_bundle.js', \"Some unique text\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"should pass through loader errors\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        optimization: {\n          emitOnErrors: true,\n        },\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template: path.join(__dirname, \"fixtures/invalid.html\"),\n          }),\n        ],\n      },\n      [\"ReferenceError: foo is not defined\"],\n      null,\n      done,\n      true,\n    );\n  });\n\n  it(\"uses a custom loader from webpack config (pug)\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        module: {\n          rules: [{ test: /\\.pug$/, loader: \"pug-loader\" }],\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template: path.join(__dirname, \"fixtures/template.pug\"),\n          }),\n        ],\n      },\n      ['<script src=\"app_bundle.js', \"Some unique text\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"uses a custom loader from webpack config (handlebars)\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        module: {\n          rules: [{ test: /\\.hbs$/, loader: \"handlebars-loader\" }],\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template: path.join(__dirname, \"fixtures/template.hbs\"),\n          }),\n        ],\n      },\n      ['<script src=\"app_bundle.js', \"Some unique text\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"works when using html-loader\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            template:\n              \"html-loader!\" + path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to specify your own HTML template file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/test.html\"),\n            inject: false,\n          }),\n        ],\n      },\n      ['<script src=\"app_bundle.js', \"Some unique text\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows to use a function to map entry names to filenames\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: (entry) => `${entry}.html`,\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js'],\n      \"app.html\",\n      done,\n    );\n  });\n\n  it(\"allows to use [name] for file names\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: \"[name].html\",\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js'],\n      \"app.html\",\n      done,\n    );\n  });\n\n  it(\"picks up src/index.ejs by default\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        context: path.join(__dirname, \"fixtures\"),\n        entry: {\n          app: \"./index.js\",\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js', \"src/index.ejs\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject the assets into a given html file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"util_bundle.js\"',\n        '<script defer=\"defer\" src=\"app_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject the assets into the body of the given template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: \"body\",\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"util_bundle.js\"',\n        '<script defer=\"defer\" src=\"app_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject the assets into the head of the given template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: \"head\",\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"util_bundle.js\"',\n        '<script defer=\"defer\" src=\"app_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject a specified asset into a given html file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            chunks: [\"app\"],\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject a specified asset into a given html file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            excludeChunks: [\"util\"],\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to use chunkhash with asset into a given html file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template: path.join(__dirname, \"fixtures/webpackconfig.html\"),\n          }),\n        ],\n      },\n      [\n        {\n          type: \"chunkhash\",\n          chunkName: \"app\",\n          containStr: '<script src=\"app_bundle.js\"',\n        },\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to disable injection\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      [\"<body></body>\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to specify your own HTML template function\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: { app: path.join(__dirname, \"fixtures/index.js\") },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"app_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            templateContent: function () {\n              return fs.readFileSync(\n                path.join(__dirname, \"fixtures/plain.html\"),\n                \"utf8\",\n              );\n            },\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"works with source maps\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        devtool: \"source-map\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer src=\"index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"handles hashes in bundle filenames\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle_[hash].js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [/<script defer=\"defer\" src=\"index_bundle_[0-9a-f]+\\.js\"*/],\n      null,\n      done,\n    );\n  });\n\n  it(\"handles hashes in the directory which has the bundle file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"/dist/[hash]/\",\n          filename: \"index_bundle_[hash].js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        /<script defer=\"defer\" src=\"\\/dist\\/[0-9a-f]+\\/index_bundle_[0-9a-f]+\\.js\"*/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows to append hashes to the assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ hash: true })],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows to append hashes to the assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ hash: true, inject: true })],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should work with the css extract plugin\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin(),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"styles.css\" rel=\"stylesheet\">'],\n      null,\n      done,\n    );\n  });\n\n  it(\"works with a javascript returning loader like raw-loader\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        module: {\n          rules: [{ test: /\\.html$/, use: [\"raw-loader\"] }],\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name].js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            template: path.join(__dirname, \"fixtures/plain.html\"),\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"main.js\"',\n        \"<title>Example Plain file</title>\",\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should work with the css extract plugin on windows and protocol relative urls support (#205)\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"//localhost:8080/\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin(),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"//localhost:8080/styles.css\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with the css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"/some/\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            hash: true,\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"/some/styles.css?%hash%\"'],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with the css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"/some\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ hash: true }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"/some/styles.css?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with the css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"some/\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ hash: true }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"some/styles.css?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with the css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ hash: true }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"styles.css?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with the css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            hash: true,\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"../styles.css?%hash%\"'],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it(\"should inject css files when using the extract text plugin\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ inject: true }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"styles.css\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to add cache hashes to with injected css assets\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ hash: true, inject: true }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"styles.css?%hash%\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should output xhtml link stylesheet tag\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            xhtml: true,\n            minify: {\n              keepClosingSlash: true,\n            },\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      ['<link href=\"styles.css\" rel=\"stylesheet\"/>'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to function\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath() {\n            return \"/\";\n          },\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to /some/\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"/some/\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"/some/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to /some\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"/some\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"/some/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to /some\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"some/\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"some/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to undefined\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"prepends the publicPath to undefined\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"../index_bundle.js\"'],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it('prepends the publicPath to script defer=\"defer\" src', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          publicPath: \"http://cdn.example.com/assets/\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        '<script defer=\"defer\" src=\"http://cdn.example.com/assets/index_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"handles subdirectories in the webpack output bundles\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n          publicPath: \"/\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"/assets/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows to set public path to an empty string\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n          publicPath: \"\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: \"foo/index.html\",\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"assets/index_bundle.js\"'],\n      \"foo/index.html\",\n      done,\n    );\n  });\n\n  it(\"allows to set the html-webpack-plugin public path to an empty string\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n          publicPath: \"/\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: \"foo/index.html\",\n            publicPath: \"\",\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"assets/index_bundle.js\"'],\n      \"foo/index.html\",\n      done,\n    );\n  });\n\n  it(\"handles subdirectories in the webpack output bundles along with a relative path\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      ['<script defer=\"defer\" src=\"assets/index_bundle.js\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"handles subdirectories in the webpack output bundles along with a relative path\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"../assets/index_bundle.js\"'],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it(\"handles subdirectories in the webpack output bundles along with a absolute path\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n          publicPath: \"http://cdn.example.com/\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        '<script defer=\"defer\" src=\"http://cdn.example.com/assets/index_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to configure the title of the generated HTML page\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ title: \"My Cool App\" })],\n      },\n      [\"<title>My Cool App</title>\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to configure the output filename\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ filename: \"test.html\" })],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js\"'],\n      \"test.html\",\n      done,\n    );\n  });\n\n  it(\"will replace [hash] in the filename with the child compilation hash\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: \"test-[hash].html\",\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js\"'],\n      /test-\\S+\\.html$/,\n      done,\n    );\n  });\n\n  it(\"should work with hash options provided in output options\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n          hashDigestLength: 16,\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ filename: \"index.[contenthash].html\" }),\n        ],\n      },\n      [],\n      /index\\.[a-z0-9]{16}\\.html/,\n      done,\n    );\n  });\n\n  it(\"should allow filename in the format of [contenthash:<length>]\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ filename: \"index.[contenthash:4].html\" }),\n        ],\n      },\n      [],\n      /index\\.[a-z0-9]{4}\\.html/,\n      done,\n    );\n  });\n\n  it(\"will replace [contenthash] in the filename with a content hash of 32 hex characters\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ filename: \"index.[contenthash].html\" }),\n        ],\n      },\n      [],\n      /index\\.[a-f0-9]{20}\\.html/,\n      done,\n    );\n  });\n\n  it(\"will replace [templatehash] in the filename with a content hash of 32 hex characters\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({ filename: \"index.[templatehash].html\" }),\n        ],\n      },\n      [],\n      /index\\.[a-f0-9]{20}\\.html/,\n      done,\n    );\n  });\n\n  it(\"allows you to use an absolute output filename\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"../index_bundle.js\"'],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it(\"allows you to use an absolute output filename outside the output path\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: path.join(OUTPUT_DIR, \"app\"),\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: path.resolve(OUTPUT_DIR, \"test.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app/index_bundle.js\"'],\n      \"test.html\",\n      done,\n    );\n  });\n\n  it(\"allows you to use an relative output filename outside the output path\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: path.join(OUTPUT_DIR, \"app\"),\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            filename: \"../test.html\",\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app/index_bundle.js\"'],\n      \"test.html\",\n      done,\n    );\n  });\n\n  it(\"will try to use a relative name if the filename is in a subdirectory\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ filename: \"assets/test.html\" })],\n      },\n      ['<script defer=\"defer\" src=\"../index_bundle.js\"'],\n      \"assets/test.html\",\n      done,\n    );\n  });\n\n  it('will try to use a relative name if the filename and the script defer=\"defer\" are in a subdirectory', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"assets/index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ filename: \"assets/demo/test.html\" })],\n      },\n      ['<script defer=\"defer\" src=\"../../assets/index_bundle.js\"'],\n      \"assets/demo/test.html\",\n      done,\n    );\n  });\n\n  it(\"allows you write multiple HTML files\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin(),\n          new HtmlWebpackPlugin({\n            filename: \"second-file.html\",\n            template: path.join(__dirname, \"fixtures/test.html\"),\n          }),\n          new HtmlWebpackPlugin({\n            filename: \"third-file.html\",\n            template: path.join(__dirname, \"fixtures/test.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js\"'],\n      null,\n      () => {\n        expect(fs.existsSync(path.join(OUTPUT_DIR, \"second-file.html\"))).toBe(\n          true,\n        );\n        expect(fs.existsSync(path.join(OUTPUT_DIR, \"third-file.html\"))).toBe(\n          true,\n        );\n        done();\n      },\n    );\n  });\n\n  it(\"should inject js css files even if the html file is incomplete\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/empty_html.html\"),\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      [\n        '<link href=\"styles.css\"',\n        '<script defer=\"defer\" src=\"index_bundle.js\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"exposes the webpack configuration to templates\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"https://cdn.com\",\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/webpackconfig.html\"),\n          }),\n        ],\n      },\n      [\"Public path is https://cdn.com\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"fires the html-webpack-plugin-alter-asset-tags event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).alterAssetTags.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              expect(Object.keys(object.assetTags)).toEqual([\n                \"scripts\",\n                \"styles\",\n                \"meta\",\n              ]);\n              eventFired = true;\n              callback();\n            },\n          );\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows events to add a no-value attribute\", (done) => {\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).alterAssetTags.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              pluginArgs.assetTags.scripts = pluginArgs.assetTags.scripts.map(\n                (tag) => {\n                  if (tag.tagName === \"script\") {\n                    tag.attributes.specialAttribute = true;\n                  }\n                  return tag;\n                },\n              );\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [\n        /[\\s]*<script defer=\"defer\" src=\"app_bundle.js\" specialattribute><\\/script>[\\s]*<\\/head>/,\n      ],\n      null,\n      done,\n      false,\n      false,\n    );\n  });\n\n  it(\"allows events to remove an attribute by setting it to false\", (done) => {\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).alterAssetTags.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              pluginArgs.assetTags.scripts = pluginArgs.assetTags.scripts.map(\n                (tag) => {\n                  if (tag.tagName === \"script\") {\n                    tag.attributes.async = false;\n                  }\n                  return tag;\n                },\n              );\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [/<script defer=\"defer\" src=\"app_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      done,\n      false,\n      false,\n    );\n  });\n\n  it(\"allows events to remove an attribute by setting it to null\", (done) => {\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).alterAssetTags.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              pluginArgs.assetTags.scripts = pluginArgs.assetTags.scripts.map(\n                (tag) => {\n                  if (tag.tagName === \"script\") {\n                    tag.attributes.async = null;\n                  }\n                  return tag;\n                },\n              );\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [/<script defer=\"defer\" src=\"app_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      done,\n      false,\n      false,\n    );\n  });\n\n  it(\"allows events to remove an attribute by setting it to undefined\", (done) => {\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).alterAssetTags.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              pluginArgs.assetTags.scripts = pluginArgs.assetTags.scripts.map(\n                (tag) => {\n                  if (tag.tagName === \"script\") {\n                    tag.attributes.async = undefined;\n                  }\n                  return tag;\n                },\n              );\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [/<script defer=\"defer\" src=\"app_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      done,\n      false,\n      false,\n    );\n  });\n\n  it(\"provides the options to the afterEmit event\", (done) => {\n    let eventArgs;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(compilation).afterEmit.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              eventArgs = pluginArgs;\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            foo: \"bar\",\n          }),\n          examplePlugin,\n        ],\n      },\n      [/<script defer=\"defer\" src=\"app_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      () => {\n        expect(eventArgs.plugin.options.foo).toBe(\"bar\");\n        done();\n      },\n      false,\n      false,\n    );\n  });\n\n  it(\"provides the outputName to the afterEmit event\", (done) => {\n    let eventArgs;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(compilation).afterEmit.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (pluginArgs, callback) => {\n              eventArgs = pluginArgs;\n              callback(null, pluginArgs);\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [/<script defer=\"defer\" src=\"app_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      () => {\n        expect(eventArgs.outputName).toBe(\"index.html\");\n        done();\n      },\n      false,\n      false,\n    );\n  });\n\n  it(\"fires the html-webpack-plugin-after-template-execution event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).afterTemplateExecution.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              eventFired = true;\n              callback();\n            },\n          );\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"fires the html-webpack-plugin-before-emit event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFired = true;\n            callback();\n          });\n        });\n      },\n    };\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"fires the html-webpack-plugin-after-emit event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(compilation).afterEmit.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              eventFired = true;\n              callback();\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n    );\n  });\n\n  it(\"allows to modify the html during html-webpack-plugin-before-emit event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFired = true;\n            object.html += \"Injected by plugin\";\n            callback();\n          });\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [\"Injected by plugin\"],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows to access all hooks from within a plugin\", (done) => {\n    let hookNames;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          hookNames = Object.keys(\n            HtmlWebpackPlugin.getCompilationHooks(compilation),\n          ).sort();\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(hookNames).toEqual([\n          \"afterEmit\",\n          \"afterTemplateExecution\",\n          \"alterAssetTagGroups\",\n          \"alterAssetTags\",\n          \"beforeAssetTagGeneration\",\n          \"beforeEmit\",\n        ]);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows to modify sequentially the html during html-webpack-plugin-before-emit event by edit the given arguments object\", (done) => {\n    let eventFiredForFirstPlugin = false;\n    let eventFiredForSecondPlugin = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForFirstPlugin = true;\n            object.html += \"Injected by first plugin\";\n            callback(null, object);\n          });\n        });\n      },\n    };\n    const secondExamplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForSecondPlugin = true;\n            object.html += \" Injected by second plugin\";\n            callback(null);\n          });\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin, secondExamplePlugin],\n      },\n      [\"Injected by first plugin Injected by second plugin\"],\n      null,\n      () => {\n        expect(eventFiredForFirstPlugin).toBe(true);\n        expect(eventFiredForSecondPlugin).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows to modify sequentially the html during html-webpack-plugin-before-emit event either by edit the given arguments object or by return a new object in the callback\", (done) => {\n    let eventFiredForFirstPlugin = false;\n    let eventFiredForSecondPlugin = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForFirstPlugin = true;\n            const result = _extend(object, {\n              html: object.html + \"Injected by first plugin\",\n            });\n            callback(null, result);\n          });\n        });\n      },\n    };\n    const secondExamplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForSecondPlugin = true;\n            object.html += \" Injected by second plugin\";\n            callback(null);\n          });\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin, secondExamplePlugin],\n      },\n      [\"Injected by first plugin Injected by second plugin\"],\n      null,\n      () => {\n        expect(eventFiredForFirstPlugin).toBe(true);\n        expect(eventFiredForSecondPlugin).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows to modify sequentially the html during html-webpack-plugin-before-emit event by return a new object in the callback\", (done) => {\n    let eventFiredForFirstPlugin = false;\n    let eventFiredForSecondPlugin = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForFirstPlugin = true;\n            const result = _extend(object, {\n              html: object.html + \"Injected by first plugin\",\n            });\n            callback(null, result);\n          });\n        });\n      },\n    };\n    const secondExamplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeEmit.tapAsync(\"HtmlWebpackPluginTest\", (object, callback) => {\n            eventFiredForSecondPlugin = true;\n            const result = _extend(object, {\n              html: object.html + \" Injected by second plugin\",\n            });\n            callback(null, result);\n          });\n        });\n      },\n    };\n\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin, secondExamplePlugin],\n      },\n      [\"Injected by first plugin Injected by second plugin\"],\n      null,\n      () => {\n        expect(eventFiredForFirstPlugin).toBe(true);\n        expect(eventFiredForSecondPlugin).toBe(true);\n        done();\n      },\n    );\n  });\n\n  it(\"allows to modify the html during html-webpack-plugin-after-template-execution event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).afterTemplateExecution.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              eventFired = true;\n              object.bodyTags.push(\n                HtmlWebpackPlugin.createHtmlTagObject(\"script\", {\n                  src: \"funky-script.js\",\n                }),\n              );\n              object.html += \"Injected by plugin\";\n              callback();\n            },\n          );\n        });\n      },\n    };\n\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [\"Injected by plugin\", '<script src=\"funky-script.js\"'],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n\n  it(\"allows to modify the html during html-webpack-plugin-before-asset-tag-generation event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeAssetTagGeneration.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              eventFired = true;\n              object.assets.js.push(\"funky-script.js\");\n              callback();\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: false,\n            template:\n              \"pug-loader!\" + path.join(__dirname, \"fixtures/template.pug\"),\n          }),\n          examplePlugin,\n        ],\n      },\n      ['<script src=\"funky-script.js\"'],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n    );\n  });\n\n  it(\"allows to inject files during html-webpack-plugin-before-asset-tag-generation event\", (done) => {\n    let eventFired = false;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          HtmlWebpackPlugin.getCompilationHooks(\n            compilation,\n          ).beforeAssetTagGeneration.tapAsync(\n            \"HtmlWebpackPluginTest\",\n            (object, callback) => {\n              eventFired = true;\n              object.assets.js.push(\"funky-script.js\");\n              callback();\n            },\n          );\n        });\n      },\n    };\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      ['<script defer=\"defer\" src=\"funky-script.js\"'],\n      null,\n      () => {\n        expect(eventFired).toBe(true);\n        done();\n      },\n    );\n  });\n\n  it(\"fires the events in the correct order\", (done) => {\n    const hookCallOrder = [\n      \"beforeAssetTagGeneration\",\n      \"alterAssetTags\",\n      \"alterAssetTagGroups\",\n      \"afterTemplateExecution\",\n      \"beforeEmit\",\n      \"afterEmit\",\n    ];\n    let eventsFired = [];\n    let hookLength = 0;\n    const examplePlugin = {\n      apply: function (compiler) {\n        compiler.hooks.compilation.tap(\"HtmlWebpackPlugin\", (compilation) => {\n          const hooks = HtmlWebpackPlugin.getCompilationHooks(compilation);\n          hookLength = hooks.length;\n          // Hook into all hooks\n          Object.keys(hooks).forEach((hookName) => {\n            hooks[hookName].tapAsync(\n              \"HtmlWebpackPluginTest\",\n              (object, callback) => {\n                eventsFired.push(hookName);\n                callback();\n              },\n            );\n          });\n        });\n      },\n    };\n    const shouldExpectWarnings = webpackMajorVersion < 4;\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin(), examplePlugin],\n      },\n      [],\n      null,\n      () => {\n        expect(hookLength).not.toBe(0);\n        expect(eventsFired).toEqual(hookCallOrder);\n        done();\n      },\n      false,\n      shouldExpectWarnings,\n    );\n  });\n  it(\"works with commons chunk plugin\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        optimization: {\n          splitChunks: {\n            cacheGroups: {\n              commons: {\n                chunks: \"initial\",\n                name: \"common\",\n                enforce: true,\n              },\n            },\n          },\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        /<script defer=\"defer\" src=\"common_bundle.js\">[\\s\\S]*<script defer=\"defer\" src=\"util_bundle.js\">/,\n        /<script defer=\"defer\" src=\"common_bundle.js\"[\\s\\S]*<script defer=\"defer\" src=\"index_bundle.js\">/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a base tag with attributes\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            base: {\n              href: \"http://example.com/page.html\",\n              target: \"_blank\",\n            },\n          }),\n        ],\n      },\n      [/<base href=\"http:\\/\\/example\\.com\\/page\\.html\" target=\"_blank\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a base tag short syntax\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            base: \"http://example.com/page.html\",\n          }),\n        ],\n      },\n      [/<base href=\"http:\\/\\/example\\.com\\/page\\.html\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a meta tag\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            meta: {\n              viewport: {\n                name: \"viewport\",\n                content:\n                  \"width=device-width, initial-scale=1, shrink-to-fit=no\",\n              },\n            },\n          }),\n        ],\n      },\n      [\n        /<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,shrink-to-fit=no\">/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"avoid duplicate meta tags for default template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        context: path.join(__dirname, \"fixtures\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [\n        /<head><meta charset=\"utf-8\"\\/><meta name=\"viewport\" content=\"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,viewport-fit=cover\"><title>src\\/index\\.ejs<\\/title><script defer=\"defer\" src=\"index_bundle.js\"><\\/script><\\/head>/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a meta tag with short notation\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            meta: {\n              viewport: \"width=device-width, initial-scale=1, shrink-to-fit=no\",\n            },\n          }),\n        ],\n      },\n      [\n        /<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,shrink-to-fit=no\">/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with publicPath set to /some/\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"/some/\",\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"\\/some\\/+[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with publicPath set to /some\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"/some\",\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"\\/some\\/+[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with publicPath set to some/\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"some/\",\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"some\\/+[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with publicPath undefined\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with publicPath undefined\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n            filename: path.resolve(OUTPUT_DIR, \"subfolder\", \"test.html\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"\\.\\.\\/[^\"]+\\.ico\">/],\n      path.join(\"subfolder\", \"test.html\"),\n      done,\n    );\n  });\n\n  it(\"adds a favicon with a publicPath set to /[hash]/ and replaces the hash\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"/[hash]/\",\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"\\/[a-z0-9]{20}\\/favicon\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with a publicPath set to [hash]/ and replaces the hash\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          publicPath: \"[hash]/\",\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"[a-z0-9]{20}\\/favicon\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with inject enabled\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"[^\"]+\\.ico\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"adds a favicon with xhtml enabled\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            xhtml: true,\n            minify: {\n              keepClosingSlash: true,\n            },\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n          }),\n        ],\n      },\n      [/<link rel=\"icon\" href=\"[^\"]+\\.ico\"\\/>/],\n      null,\n      done,\n    );\n  });\n\n  it(\"shows an error if the favicon could not be load\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        optimization: {\n          emitOnErrors: true,\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: true,\n            favicon: path.join(__dirname, \"fixtures/does_not_exist.ico\"),\n          }),\n        ],\n      },\n      [\"Error: HtmlWebpackPlugin: could not load file\"],\n      null,\n      done,\n      true,\n    );\n  });\n\n  it(\"works with webpack BannerPlugin\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new webpack.BannerPlugin(\"Copyright and such.\"),\n          new HtmlWebpackPlugin(),\n        ],\n      },\n      [\"<html\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"shows an error when a template fails to load\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(\n              __dirname,\n              \"fixtures/non-existing-template.html\",\n            ),\n          }),\n        ],\n      },\n      [\n        Number(webpackMajorVersion) >= 5\n          ? \"Child compilation failed:\\n  Module not found:\"\n          : \"Child compilation failed:\\n  Entry module not found:\",\n      ],\n      null,\n      done,\n      true,\n    );\n  });\n\n  it(\"should sort the chunks in auto mode\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          util: path.join(__dirname, \"fixtures/util.js\"),\n          index: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        optimization: {\n          splitChunks: {\n            cacheGroups: {\n              commons: {\n                chunks: \"initial\",\n                name: \"common\",\n                enforce: true,\n              },\n            },\n          },\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            chunksSortMode: \"auto\",\n          }),\n        ],\n      },\n      [\n        /(<script defer=\"defer\" src=\"common_bundle.js\">.+<script defer=\"defer\" src=\"util_bundle.js\">.+<script defer=\"defer\" src=\"index_bundle.js\">)|(<script defer=\"defer\" src=\"common_bundle.js\">.+<script defer=\"defer\" src=\"index_bundle.js\">.+<script defer=\"defer\" src=\"util_bundle.js\">)/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should sort the chunks in custom (reverse alphabetical) order\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          b: path.join(__dirname, \"fixtures/index.js\"),\n          c: path.join(__dirname, \"fixtures/util.js\"),\n          a: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            chunksSortMode: function (a, b) {\n              if (a < b) {\n                return 1;\n              }\n              if (a > b) {\n                return -1;\n              }\n              return 0;\n            },\n          }),\n        ],\n      },\n      [\n        /<script defer=\"defer\" src=\"c_bundle.js\">.+<script defer=\"defer\" src=\"b_bundle.js\">.+<script defer=\"defer\" src=\"a_bundle.js\">/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should sort manually by the chunks\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          b: path.join(__dirname, \"fixtures/util.js\"),\n          a: path.join(__dirname, \"fixtures/theme.js\"),\n          d: path.join(__dirname, \"fixtures/util.js\"),\n          c: path.join(__dirname, \"fixtures/theme.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        module: {\n          rules: [{ test: /\\.css$/, loader: \"css-loader\" }],\n        },\n        optimization: {\n          splitChunks: {\n            cacheGroups: {\n              commons: {\n                chunks: \"initial\",\n                name: \"common\",\n                enforce: true,\n              },\n            },\n          },\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            chunksSortMode: \"manual\",\n            chunks: [\"common\", \"a\", \"b\", \"c\"],\n          }),\n        ],\n      },\n      [\n        /<script defer=\"defer\" src=\"common_bundle.js\">.+<script defer=\"defer\" src=\"a_bundle.js\">.+<script defer=\"defer\" src=\"b_bundle.js\">.+<script defer=\"defer\" src=\"c_bundle.js\">/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should add the webpack compilation object as a property of the templateParam object\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.js\"),\n            inject: false,\n          }),\n        ],\n      },\n      ['templateParams keys: \"compilation,webpackConfig,htmlWebpackPlugin\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should add the webpack compilation object as a property of the templateParam object with cjs\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.cjs\"),\n            inject: false,\n          }),\n        ],\n      },\n      ['templateParams keys: \"compilation,webpackConfig,htmlWebpackPlugin\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to disable template parameters\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.js\"),\n            inject: false,\n            templateParameters: false,\n          }),\n        ],\n      },\n      ['templateParams keys: \"\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to set specific template parameters\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.js\"),\n            inject: false,\n            templateParameters: { foo: \"bar\" },\n          }),\n        ],\n      },\n      [\n        'templateParams keys: \"compilation,webpackConfig,htmlWebpackPlugin,foo\"',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to set specific template parameters using a function\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.js\"),\n            inject: false,\n            templateParameters: function () {\n              return { foo: \"bar\" };\n            },\n          }),\n        ],\n      },\n      ['templateParams keys: \"foo\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to set specific template parameters using a async function\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/templateParam.js\"),\n            inject: false,\n            templateParameters: function () {\n              return Promise.resolve({ foo: \"bar\" });\n            },\n          }),\n        ],\n      },\n      ['templateParams keys: \"foo\"'],\n      null,\n      done,\n    );\n  });\n\n  it(\"should not treat templateContent set to an empty string as missing\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: { app: path.join(__dirname, \"fixtures/index.js\") },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"app_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            templateContent: \"\",\n          }),\n        ],\n      },\n      [/^<head><script defer=\"defer\" src=\"app_bundle\\.js\"><\\/script><\\/head>$/],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject the assets into the body of the given spaced closing tag template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: \"body\",\n            template: path.join(__dirname, \"fixtures/spaced_plain.html\"),\n          }),\n        ],\n      },\n      [\n        /<body>[\\s]*<script defer=\"defer\" src=\"index_bundle.js\"><\\/script>[\\s]*<\\/body>/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows you to inject the assets into the head of the given spaced closing tag template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            inject: \"head\",\n            template: path.join(__dirname, \"fixtures/spaced_plain.html\"),\n          }),\n        ],\n      },\n      [/<script defer=\"defer\" src=\"index_bundle.js\"><\\/script>[\\s]*<\\/head>/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should minify by default when mode is production\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [/<!doctype html><html><head><meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should not minify by default when mode is development\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin()],\n      },\n      [/<!DOCTYPE html>\\s+<html>\\s+<head>\\s+<meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should minify in production if options.minify is true\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ minify: true })],\n      },\n      [/<!doctype html><html><head><meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should minify in development if options.minify is true\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ minify: true })],\n      },\n      [/<!doctype html><html><head><meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should not minify in production if options.minify is false\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ minify: false })],\n      },\n      [/<!DOCTYPE html>\\s+<html>\\s+<head>\\s+<meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should not minify in development if options.minify is false\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [new HtmlWebpackPlugin({ minify: false })],\n      },\n      [/<!DOCTYPE html>\\s+<html>\\s+<head>\\s+<meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow custom minify options and not merge them with the defaults\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            minify: {\n              useShortDoctype: true,\n            },\n          }),\n        ],\n      },\n      [/<!doctype html>\\s+<html>\\s+<head>\\s+<meta charset=\"utf-8\">/],\n      null,\n      done,\n    );\n  });\n\n  it('should allow to inject scripts with a defer=\"defer\" attribute', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n          }),\n        ],\n      },\n      [/<script defer=\"defer\" .+<body>/],\n      null,\n      done,\n    );\n  });\n\n  it('should allow to inject scripts with a type=\"module\" attribute', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"module\",\n          }),\n        ],\n      },\n      [/<script type=\"module\" src=\"index_bundle.js\"><\\/script>.+<body>/],\n      null,\n      done,\n    );\n  });\n\n  it('should allow to inject scripts with a type=\"systemjs-module\" attribute', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"systemjs-module\",\n          }),\n        ],\n      },\n      [\n        /<script type=\"systemjs-module\" src=\"index_bundle.js\"><\\/script>.+<body>/,\n      ],\n      null,\n      done,\n    );\n  });\n\n  it('should allow to inject scripts with a defer=\"defer\" attribute to the body', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n            inject: \"body\",\n          }),\n        ],\n      },\n      [/<body>.*<script defer=\"defer\"/],\n      null,\n      done,\n    );\n  });\n\n  it('should allow to inject scripts with a defer=\"defer\" in front of styles', (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      [/<script defer=\"defer\".+<link href=\"styles.css\"/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should keep closing slashes from the template\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n            templateContent: \"<html><body> <selfclosed /> </body></html>\",\n          }),\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n        ],\n      },\n      [/<selfclosed\\/>/],\n      null,\n      done,\n    );\n  });\n\n  it(\"should add the javascript assets to the head for inject:true with scriptLoading:defer\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n            inject: true,\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"index_bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head>',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to use headTags and bodyTags directly in string literals\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n          new HtmlWebpackPlugin({\n            scriptLoading: \"blocking\",\n            inject: false,\n            templateContent: ({ htmlWebpackPlugin }) => `\n            <html>\n              <head>${htmlWebpackPlugin.tags.headTags}</head>\n              <body>${htmlWebpackPlugin.tags.bodyTags}</body>\n            </html>\n            `,\n          }),\n        ],\n      },\n      [\n        '<head><link href=\"styles.css\" rel=\"stylesheet\"></head>',\n        '<script src=\"index_bundle.js\"></script></body>',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should add the javascript assets to the head for inject:true with scriptLoading:defer\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n          new HtmlWebpackPlugin({\n            scriptLoading: \"defer\",\n            inject: true,\n          }),\n        ],\n      },\n      [\n        '<script defer=\"defer\" src=\"index_bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head>',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to use headTags and bodyTags directly in string literals\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/theme.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.css$/,\n              use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n            },\n          ],\n        },\n        plugins: [\n          new MiniCssExtractPlugin({ filename: \"styles.css\" }),\n          new HtmlWebpackPlugin({\n            inject: false,\n            templateContent: ({ htmlWebpackPlugin }) => `\n            <html>\n              <head>${htmlWebpackPlugin.tags.headTags}</head>\n              <body>${htmlWebpackPlugin.tags.bodyTags}</body>\n            </html>\n            `,\n          }),\n        ],\n      },\n      [\n        '<head><script defer=\"defer\" src=\"index_bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head>',\n      ],\n      null,\n      done,\n    );\n  });\n\n  it(\"should allow to use experiments:{outputModule:true}\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          module: true,\n        },\n        experiments: { outputModule: true },\n        plugins: [new HtmlWebpackPlugin({})],\n      },\n      ['<script defer=\"defer\" src=\"index_bundle.js\"></script>'],\n      null,\n      done,\n    );\n  });\n\n  it(\"generates relative path for asset/resource\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          assetModuleFilename: \"assets/demo[ext]\",\n        },\n        module: {\n          rules: [{ test: /\\.png$/, type: \"asset/resource\" }],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template:\n              \"html-loader!\" + path.join(__dirname, \"fixtures/logo.html\"),\n            filename: \"demo/index.js\",\n          }),\n        ],\n      },\n      ['<img src=\"../assets/demo.png'],\n      \"demo/index.js\",\n      done,\n    );\n  });\n\n  it(\"uses the absolute path for asset/resource\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          assetModuleFilename: \"assets/demo[ext]\",\n        },\n        module: {\n          rules: [{ test: /\\.png$/, type: \"asset/resource\" }],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template:\n              \"html-loader!\" + path.join(__dirname, \"fixtures/logo.html\"),\n            filename: \"demo/index.js\",\n            publicPath: \"/foo/\",\n          }),\n        ],\n      },\n      ['<img src=\"/foo/assets/demo.png'],\n      \"demo/index.js\",\n      done,\n    );\n  });\n\n  it(\"generates an html file if entry is empty\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"development\",\n        entry: {},\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n          assetModuleFilename: \"assets/demo[ext]\",\n        },\n        plugins: [new HtmlWebpackPlugin({})],\n      },\n      [\"<body>\"],\n      null,\n      done,\n    );\n  });\n\n  it(\"allows to set custom loader interpolation settings\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        module: {\n          rules: [\n            {\n              test: /\\.html$/,\n              loader: require.resolve(\"../lib/loader.js\"),\n              options: {\n                interpolate: /\\{%=([\\s\\S]+?)%\\}/g,\n              },\n            },\n          ],\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            title: \"Interpolation Demo\",\n            template: path.join(__dirname, \"fixtures/interpolation.html\"),\n          }),\n        ],\n      },\n      [\"Interpolation Demo\"],\n      null,\n      () => {\n        done();\n      },\n    );\n  });\n\n  it(\"allows you to use empty HTML template file\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: {\n          app: path.join(__dirname, \"fixtures/index.js\"),\n        },\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"[name]_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/empty.html\"),\n          }),\n        ],\n      },\n      ['<script defer=\"defer\" src=\"app_bundle.js'],\n      null,\n      done,\n    );\n  });\n\n  it(\"allow you to use custom HTML tag attributes in templates\", (done) => {\n    testHtmlPlugin(\n      {\n        mode: \"production\",\n        entry: path.join(__dirname, \"fixtures/index.js\"),\n        output: {\n          path: OUTPUT_DIR,\n          filename: \"index_bundle.js\",\n        },\n        plugins: [\n          new HtmlWebpackPlugin({\n            template: path.join(__dirname, \"fixtures/template.ejs\"),\n            baseHref: \"/\",\n            minify: false,\n            appMountIds: [\"react-app\", \"portal-root\"],\n            favicon: path.join(__dirname, \"fixtures/favicon.ico\"),\n            inject: false,\n          }),\n        ],\n      },\n      [\n        /<script src=\"index_bundle.js\" type=\"text\\/javascript\" nonce=\"NONCE\"><\\/script>/,\n      ],\n      null,\n      done,\n    );\n  });\n});\n"
  },
  {
    "path": "spec/caching.spec.js",
    "content": "/*\n * Integration tests for caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst webpack = require(\"webpack\");\nconst rimraf = require(\"rimraf\");\nconst WebpackRecompilationSimulator = require(\"webpack-recompilation-simulator\");\nconst HtmlWebpackPlugin = require(\"../index.js\");\n\nconst OUTPUT_DIR = path.join(__dirname, \"../dist/caching-spec\");\n\njest.setTimeout(30000);\nprocess.on(\"unhandledRejection\", (r) => console.log(r));\n\nfunction setUpCompiler(htmlWebpackPlugin) {\n  jest.spyOn(htmlWebpackPlugin, \"evaluateCompilationResult\");\n  const webpackConfig = {\n    stats: { all: true },\n    // Caching works only in development\n    mode: \"development\",\n    entry: path.join(__dirname, \"fixtures/index.js\"),\n    module: {\n      rules: [\n        {\n          test: /\\.html$/,\n          loader: require.resolve(\"../lib/loader.js\"),\n          options: {\n            force: true,\n          },\n        },\n      ],\n    },\n    output: {\n      path: OUTPUT_DIR,\n      filename: \"index_bundle.js\",\n    },\n    plugins: Array.from(arguments),\n  };\n  const compiler = new WebpackRecompilationSimulator(webpack(webpackConfig));\n  return compiler;\n}\n\nfunction getCompiledModules(statsJson) {\n  const builtModules = statsJson.modules\n    .filter((webpackModule) => webpackModule.built)\n    .map((webpackModule) => {\n      return webpackModule.name;\n    });\n  statsJson.children.forEach((childCompilationStats) => {\n    const builtChildModules = getCompiledModules(childCompilationStats);\n    Array.prototype.push.apply(builtModules, builtChildModules);\n  });\n  return builtModules;\n}\n\nfunction getCompiledModuleCount(statsJson) {\n  return getCompiledModules(statsJson).length;\n}\n\nfunction expectNoErrors(stats) {\n  const errors = {\n    main: stats.compilation.errors,\n    childCompilation: [],\n  };\n  stats.compilation.children.forEach((child) => {\n    Array.prototype.push.apply(errors.childCompilation, child.errors);\n  });\n  if (errors.main.length) {\n    errors.main.forEach((error) => {\n      console.log(\"Error => \", error);\n    });\n    console.dir(stats.toJson({ errorDetails: true, moduleTrace: true }), {\n      depth: 5,\n    });\n  }\n  expect(errors.main).toEqual([]);\n  expect(errors.childCompilation).toEqual([]);\n}\n\ndescribe(\"HtmlWebpackPluginCaching\", () => {\n  beforeEach((done) => {\n    rimraf(OUTPUT_DIR, done);\n  });\n\n  it(\"should compile nothing if no file was changed\", (done) => {\n    const template = path.join(__dirname, \"fixtures/plain.html\");\n    const htmlWebpackPlugin = new HtmlWebpackPlugin({\n      template: template,\n    });\n    let childCompilerHash;\n    const compiler = setUpCompiler(htmlWebpackPlugin);\n    compiler.addTestFile(path.join(__dirname, \"fixtures/index.js\"));\n    compiler\n      .run()\n      // Change the template file and compile again\n      .then(() => {\n        childCompilerHash = htmlWebpackPlugin.childCompilerHash;\n        return compiler.run();\n      })\n      .then((stats) => {\n        // Expect no errors:\n        expectNoErrors(stats);\n        // Verify that no file was built\n        expect(getCompiledModules(stats.toJson())).toEqual([]);\n        // Verify that the html was processed only during the initial build\n        expect(\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length,\n        ).toBe(1);\n        // Verify that the child compilation was executed twice\n        expect(htmlWebpackPlugin.childCompilerHash).toBe(childCompilerHash);\n      })\n      .then(done);\n  });\n\n  it(\"should not compile the webpack html file if only a javascript file was changed\", (done) => {\n    const htmlWebpackPlugin = new HtmlWebpackPlugin();\n    const compiler = setUpCompiler(htmlWebpackPlugin);\n    let childCompilerHash;\n    compiler.addTestFile(path.join(__dirname, \"fixtures/index.js\"));\n    compiler\n      .run()\n      // Change a js file and compile again\n      .then(() => {\n        childCompilerHash = htmlWebpackPlugin.childCompilerHash;\n        compiler.simulateFileChange(path.join(__dirname, \"fixtures/index.js\"), {\n          footer: \"//1\",\n        });\n        return compiler.run();\n      })\n      .then((stats) => {\n        // Expect no errors:\n        expectNoErrors(stats);\n        // Verify that only one file was built\n        expect(getCompiledModuleCount(stats.toJson())).toBe(1);\n        // Verify that the html was processed only during the initial build\n        expect(\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length,\n        ).toBe(1);\n        // Verify that the child compilation was executed only once\n        expect(htmlWebpackPlugin.childCompilerHash).toBe(childCompilerHash);\n      })\n      .then(done);\n  });\n\n  it(\"should compile the webpack html file even if only a javascript file was changed if caching is disabled\", (done) => {\n    const htmlWebpackPlugin = new HtmlWebpackPlugin({\n      cache: false,\n    });\n    let childCompilerHash;\n    const compiler = setUpCompiler(htmlWebpackPlugin);\n    compiler.addTestFile(path.join(__dirname, \"fixtures/index.js\"));\n    compiler\n      .run()\n      // Change a js file and compile again\n      .then(() => {\n        childCompilerHash = htmlWebpackPlugin.childCompilerHash;\n        compiler.simulateFileChange(path.join(__dirname, \"fixtures/index.js\"), {\n          footer: \"//1\",\n        });\n        return compiler.run();\n      })\n      .then((stats) => {\n        // Expect no errors:\n        expectNoErrors(stats);\n        // Verify that only one file was built\n        expect(getCompiledModuleCount(stats.toJson())).toBe(1);\n        // Verify that the html was processed on every run\n        expect(\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length,\n        ).toBe(2);\n        // Verify that the child compilation was executed only once\n        expect(htmlWebpackPlugin.childCompilerHash).toBe(childCompilerHash);\n      })\n      .then(done);\n  });\n\n  it(\"should compile the webpack html if the template file was changed\", (done) => {\n    const template = path.join(__dirname, \"fixtures/plain.html\");\n    const htmlWebpackPlugin = new HtmlWebpackPlugin({\n      template: template,\n    });\n    const compiler = setUpCompiler(htmlWebpackPlugin);\n    compiler.addTestFile(template);\n    compiler\n      .run()\n      // Change the template file and compile again\n      .then(() => {\n        compiler.simulateFileChange(template, { footer: \"<!-- 1 -->\" });\n        return compiler.run();\n      })\n      .then((stats) => {\n        // Expect no errors:\n        expectNoErrors(stats);\n        // Verify that only one file was built\n        expect(getCompiledModuleCount(stats.toJson())).toBe(1);\n        // Verify that the html was processed twice\n        expect(\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length,\n        ).toBe(2);\n\n        const [evaluateCompilationResultArgs1, evaluateCompilationResultArgs2] =\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls;\n        const compiledSource = evaluateCompilationResultArgs1[0];\n        const compiledSourceSecondRun = evaluateCompilationResultArgs2[0];\n\n        // Verify that the child compilation was executed twice\n        expect(compiledSource).not.toBe(compiledSourceSecondRun);\n      })\n      .then(done);\n  });\n\n  it(\"should not slow down linear (10 plugins should not take 2.5 as much time as a 1 plugin)\", (done) => {\n    const template = path.join(__dirname, \"fixtures/plain.html\");\n    const createHtmlWebpackPlugin = () =>\n      new HtmlWebpackPlugin({\n        template: template,\n        minify: false,\n      });\n    let singlePluginCompileStart;\n    let singleCompileRunDuration;\n    let multiPluginCompileStart;\n    let multiCompileRunDuration;\n\n    let singleCompiler = setUpCompiler(createHtmlWebpackPlugin());\n    let multiCompiler = setUpCompiler.apply(\n      null,\n      Array(10)\n        .fill(0)\n        .map(() => createHtmlWebpackPlugin()),\n    );\n\n    Promise.resolve()\n      .then(function singleCompileRun() {\n        singlePluginCompileStart = process.hrtime();\n        return (\n          singleCompiler\n            .run()\n            // Change the template file and compile again\n            .then(() => {\n              singleCompileRunDuration = process.hrtime(\n                singlePluginCompileStart,\n              );\n            })\n        );\n      })\n      .then(function multiCompileRun() {\n        multiPluginCompileStart = process.hrtime();\n        return (\n          multiCompiler\n            .run()\n            // Change the template file and compile again\n            .then(() => {\n              multiCompileRunDuration = process.hrtime(multiPluginCompileStart);\n            })\n        );\n      })\n      .then(function measureTime() {\n        const singleCompileRunDurationInNs =\n          singleCompileRunDuration[0] * 1e9 + singleCompileRunDuration[1];\n        const multiCompileRunDurationInNs =\n          multiCompileRunDuration[0] * 1e9 + multiCompileRunDuration[1];\n        const speedComparison =\n          (multiCompileRunDurationInNs / singleCompileRunDurationInNs) * 100;\n\n        expect(speedComparison).toBeLessThan(260);\n        done();\n      });\n  });\n\n  it(\"should keep watching the webpack html if only a js file was changed\", (done) => {\n    const template = path.join(__dirname, \"fixtures/plain.html\");\n    const jsFile = path.join(__dirname, \"fixtures/index.js\");\n    const htmlWebpackPlugin = new HtmlWebpackPlugin({\n      template: template,\n    });\n    const compiler = setUpCompiler(htmlWebpackPlugin);\n    compiler.addTestFile(template);\n    compiler.addTestFile(jsFile);\n    // Build the template file for the first time\n    compiler\n      .startWatching()\n      // Change the template file (second build)\n      .then(() => {\n        compiler.simulateFileChange(template, { footer: \"<!-- 1 -->\" });\n        return compiler.waitForWatchRunComplete();\n      })\n      // Change js\n      .then(() => {\n        compiler.simulateFileChange(jsFile, { footer: \"// 1\" });\n        return compiler.waitForWatchRunComplete();\n      })\n      // Change js\n      .then(() => {\n        compiler.simulateFileChange(jsFile, { footer: \"// 2\" });\n        return compiler.waitForWatchRunComplete();\n      })\n      // Change js\n      .then(() => {\n        compiler.simulateFileChange(jsFile, { footer: \"// 3\" });\n        return compiler.waitForWatchRunComplete();\n      })\n      // Change the template file (third build)\n      .then(() => {\n        compiler.simulateFileChange(template, { footer: \"<!-- 2 -->\" });\n        return compiler.waitForWatchRunComplete();\n      })\n      .then(() => {\n        // Verify that the html was processed trice\n        expect(\n          htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length,\n        ).toBe(3);\n      })\n      .then(() => compiler.stopWatching())\n      .then(done);\n  });\n});\n"
  },
  {
    "path": "spec/example.spec.js",
    "content": "/*\n * These integration tests compile all cases from the example folder\n * and matches them against their dist folder\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst webpack = require(\"webpack\");\nconst rimraf = require(\"rimraf\");\nconst fs = require(\"fs\");\nconst webpackMajorVersion = require(\"webpack/package.json\").version.split(\n  \".\",\n)[0];\n\nconst OUTPUT_DIR = path.resolve(__dirname, \"../dist\");\n\njest.setTimeout(30000);\n\nfunction runExample(exampleName, done) {\n  const examplePath = path.resolve(__dirname, \"..\", \"examples\", exampleName);\n  const exampleOutput = path.join(OUTPUT_DIR, exampleName);\n  const fixturePath = path.resolve(\n    examplePath,\n    \"dist\",\n    \"webpack-\" + webpackMajorVersion,\n  );\n  // Clear old results\n  rimraf(exampleOutput, () => {\n    const options = require(path.join(examplePath, \"webpack.config.js\"));\n    options.context = examplePath;\n    options.output.path = exampleOutput + path.sep;\n    if (Number(webpackMajorVersion) >= 4) {\n      options.plugins.unshift(\n        new webpack.LoaderOptionsPlugin({\n          options: {\n            context: process.cwd(), // or the same value as `context`\n          },\n        }),\n      );\n      if (options.module && options.module.loaders) {\n        options.module.rules = options.module.loaders;\n        delete options.module.loaders;\n      }\n      options.mode = \"production\";\n      options.optimization = { minimizer: [] };\n    }\n\n    webpack(options, (err, stats) => {\n      try {\n        expect(err).toBeFalsy();\n        expect(stats.compilation.errors).toEqual([]);\n\n        const dircompare = require(\"dir-compare\");\n        const res = dircompare.compareSync(fixturePath, exampleOutput, {\n          compareSize: true,\n        });\n\n        res.diffSet\n          .filter((diff) => diff.state === \"distinct\")\n          .forEach((diff) => {\n            const file1Contents = fs\n              .readFileSync(path.join(diff.path1, diff.name1))\n              .toString();\n            const file2Contents = fs\n              .readFileSync(path.join(diff.path2, diff.name2))\n              .toString();\n            expect(file1Contents).toEqual(file2Contents);\n          });\n\n        expect(res.same).toBe(true);\n        rimraf(exampleOutput, done);\n      } catch (e) {\n        done(e);\n      }\n    });\n  });\n}\n\ndescribe(\"HtmlWebpackPlugin Examples\", () => {\n  it(\"custom-template example\", (done) => {\n    runExample(\"custom-template\", done);\n  });\n\n  it(\"default example\", (done) => {\n    runExample(\"default\", done);\n  });\n\n  it(\"favicon example\", (done) => {\n    runExample(\"favicon\", done);\n  });\n\n  it(\"html-loader example\", (done) => {\n    runExample(\"html-loader\", done);\n  });\n\n  it(\"inline example\", (done) => {\n    runExample(\"inline\", done);\n  });\n\n  it(\"pug-loader example\", (done) => {\n    runExample(\"pug-loader\", done);\n  });\n\n  it(\"javascript example\", (done) => {\n    runExample(\"javascript\", done);\n  });\n\n  it(\"javascript-advanced example\", (done) => {\n    runExample(\"javascript-advanced\", done);\n  });\n\n  it(\"sort manually example\", (done) => {\n    runExample(\"sort-manually\", done);\n  });\n\n  it(\"multi-page example\", (done) => {\n    runExample(\"multi-page\", done);\n  });\n\n  it(\"template-parameters example\", (done) => {\n    runExample(\"template-parameters\", done);\n  });\n});\n"
  },
  {
    "path": "spec/fixtures/async.js",
    "content": "'use strict';\nmodule.exports = 'async';\n"
  },
  {
    "path": "spec/fixtures/common.js",
    "content": "'use strict';\n\nmodule.exports = 'common';\n"
  },
  {
    "path": "spec/fixtures/empty.html",
    "content": ""
  },
  {
    "path": "spec/fixtures/empty_html.html",
    "content": ""
  },
  {
    "path": "spec/fixtures/html-template-with-image.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\"/>\n  <title>Test</title>\n</head>\n<body>\n<p>Some unique text</p>\n<div>\n  <img src=\"./logo.png\" alt=\"Logo\">\n</div>\n</body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/index.js",
    "content": "'use strict';\n\nrequire('./common');\n\nrequire.ensure([], function () {\n  require('./async');\n});\n\ndocument.body.innerHTML = document.body.innerHTML + '<p>index.js</p>';\n"
  },
  {
    "path": "spec/fixtures/interpolation.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <title>{%= htmlWebpackPlugin.options.title %}</title>\n  </head>\n  <body>\n    <p>Some unique text</p>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/invalid.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <title>Test</title>\n  </head>\n  <body>\n    <p>Some unique text</p>\n    <script src=\"<%=foo.bar%>\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/logo.html",
    "content": "<!doctype html>\n<html lang=\"en\" manifest=\"foo.appcache\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Example Plain file</title>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n</head>\n<body>\n  <img src=\"./logo.png\" />\n</body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/main.css",
    "content": "body {\n  background: snow;\n}"
  },
  {
    "path": "spec/fixtures/plain.html",
    "content": "<!doctype html>\n<html lang=\"en\" manifest=\"foo.appcache\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Example Plain file</title>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n</head>\n<body>\n</body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/spaced_plain.html",
    "content": "<!doctype html>\n<html lang=\"en\" manifest=\"foo.appcache\">\n<head>\n</head >\n<body>\n</body >\n</html>\n"
  },
  {
    "path": "spec/fixtures/src/index.ejs",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,viewport-fit=cover\">\n    <title>src/index.ejs</title>\n  </head>\n  <body>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/template-partial.hbs",
    "content": "<div>Partial</div>\n"
  },
  {
    "path": "spec/fixtures/template.ejs",
    "content": "<!DOCTYPE html>\n<html>\n  <head></head>\n  <body>\n    <div id=\"react-app\"></div>\n    <% for (item of htmlWebpackPlugin.files.js) { %>\n      <% if (typeof item === 'string' || item instanceof String) {\n        item = { src: item, type: 'text/javascript' }\n      } %>\n      <script<% for (key in item) { %> <%= key %>=\"<%= item[key] %>\"<% } %> nonce=\"NONCE\"></script>\n    <% } %>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/template.hbs",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Demo</title>\n  </head>\n  <body>\n    <p>Some unique text</p>\n    {{> template-partial }}\n    {{#each htmlWebpackPlugin.files.js}}\n      <script src=\"{{this}}\"></script>\n    {{/each}}\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/template.pug",
    "content": "doctype html\nhtml\n  head\n    meta(charset=\"utf-8\")\n    title Demo\n  body\n    p Some unique text\n    each jsFile in htmlWebpackPlugin.files.js\n      script(src!=jsFile)\n"
  },
  {
    "path": "spec/fixtures/templateParam.cjs",
    "content": "module.exports = function (templateParams) {\n  const version = parseInt(process.version.match(/^v(\\d+)/)[1]);\n\n  if (typeof URL !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (typeof URLSearchParams !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (version >= 11 && typeof TextEncoder !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (version >= 11 && typeof TextDecoder !== 'function') {\n    throw new Error('Error');\n  }\n\n  return 'templateParams keys: \"' + Object.keys(templateParams).join(',') + '\"';\n};\n"
  },
  {
    "path": "spec/fixtures/templateParam.js",
    "content": "module.exports = function (templateParams) {\n  const version = parseInt(process.version.match(/^v(\\d+)/)[1]);\n\n  if (typeof URL !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (typeof URLSearchParams !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (version >= 11 && typeof TextEncoder !== 'function') {\n    throw new Error('Error');\n  }\n\n  if (version >= 11 && typeof TextDecoder !== 'function') {\n    throw new Error('Error');\n  }\n\n  return 'templateParams keys: \"' + Object.keys(templateParams).join(',') + '\"';\n};\n"
  },
  {
    "path": "spec/fixtures/test.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <title>Test</title>\n  </head>\n  <body>\n    <p>Some unique text</p>\n    <script src=\"<%=htmlWebpackPlugin.files.js[0]%>\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/fixtures/theme.js",
    "content": "'use strict';\n\nrequire('./main.css');\nrequire('./index.js');\n"
  },
  {
    "path": "spec/fixtures/util.js",
    "content": "'use strict';\n\nrequire('./common');\ndocument.body.innerHTML = document.body.innerHTML + '<p>util.js</p>';\n"
  },
  {
    "path": "spec/fixtures/webpackconfig.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <title>Test</title>\n  </head>\n  <body>\n    <p>Public path is <%= webpackConfig.output.publicPath %></p>\n    <script src=\"<%= htmlWebpackPlugin.files.js[0] %>\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/hot.spec.js",
    "content": "/*\n * Integration tests for caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst fs = require(\"fs\");\nconst webpack = require(\"webpack\");\nconst rimraf = require(\"rimraf\");\nconst WebpackRecompilationSimulator = require(\"webpack-recompilation-simulator\");\nconst HtmlWebpackPlugin = require(\"../index.js\");\n\nconst OUTPUT_DIR = path.join(__dirname, \"../dist/caching-spec\");\n\n// The WebpackRecompilationSimulator uses a loader to redirect the file writes to a temp directory.\n// As this would disable the default loader behaviour by design it has to be run in force mode\nconst DEFAULT_LOADER = require.resolve(\"../lib/loader.js\") + \"?force\";\nconst DEFAULT_TEMPLATE =\n  DEFAULT_LOADER + \"!\" + require.resolve(\"../default_index.ejs\");\n\njest.setTimeout(30000);\n\nprocess.on(\"unhandledRejection\", (r) => console.log(r));\n\ndescribe(\"HtmlWebpackPluginHMR\", () => {\n  afterAll((done) => {\n    rimraf(OUTPUT_DIR, done);\n  });\n\n  it(\"should not cause errors for the main compilation if hot-reload is active\", () => {\n    const outputPath = path.join(OUTPUT_DIR, \"one\");\n    const config = {\n      mode: \"development\",\n      entry: path.join(__dirname, \"fixtures/index.js\"),\n      output: {\n        path: outputPath,\n      },\n      plugins: [\n        new webpack.HotModuleReplacementPlugin(),\n        new HtmlWebpackPlugin({ template: DEFAULT_TEMPLATE }),\n      ],\n    };\n    const compiler = new WebpackRecompilationSimulator(webpack(config));\n    fs.mkdirSync(outputPath, { recursive: true });\n    const jsFileTempPath = compiler.addTestFile(\n      path.join(__dirname, \"fixtures/index.js\"),\n    );\n    fs.writeFileSync(\n      jsFileTempPath,\n      \"module.exports = function calc(a, b){ return a + b };\",\n    );\n    return (\n      compiler\n        .startWatching()\n        // Change the template file and compile again\n        .then(() => {\n          fs.writeFileSync(\n            jsFileTempPath,\n            \"module.exports = function calc(a, b){ return a - b };\",\n          );\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          expect(stats.compilation.errors).toEqual([]);\n        })\n        .then(() => compiler.stopWatching())\n    );\n  });\n\n  it(\"should not cause missing hot-reloaded code of the main compilation\", () => {\n    const outputPath = path.join(OUTPUT_DIR, \"two\");\n    const config = {\n      mode: \"development\",\n      entry: path.join(__dirname, \"fixtures/index.js\"),\n      target: \"node\",\n      output: {\n        path: outputPath,\n      },\n      plugins: [\n        new webpack.HotModuleReplacementPlugin(),\n        new HtmlWebpackPlugin({ template: DEFAULT_TEMPLATE }),\n      ],\n    };\n    const compiler = new WebpackRecompilationSimulator(webpack(config));\n    fs.mkdirSync(outputPath, { recursive: true });\n    const jsFileTempPath = compiler.addTestFile(\n      path.join(__dirname, \"fixtures/index.js\"),\n    );\n    fs.writeFileSync(jsFileTempPath, \"global = 1; module.hot.accept();\");\n    return (\n      compiler\n        .startWatching()\n        // Change the template file and compile again\n        .then(() => {\n          fs.writeFileSync(jsFileTempPath, \"global = 2; module.hot.accept();\");\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          const hotUpdateJsFileNames = Object.keys(\n            stats.compilation.assets,\n          ).filter((fileName) => /\\.hot-update\\.js$/.test(fileName));\n          expect(hotUpdateJsFileNames).not.toEqual([]);\n          expect(hotUpdateJsFileNames.length).toEqual(1);\n          const hotUpdateFileSize =\n            stats.compilation.assets[hotUpdateJsFileNames[0]].size();\n          expect(hotUpdateFileSize).not.toEqual(0);\n        })\n        .then(() => compiler.stopWatching())\n    );\n  });\n\n  it(\"should re-emit favicon and assets from a loader if watch is active\", () => {\n    const outputPath = path.join(OUTPUT_DIR, \"three\");\n    const template = path.join(\n      __dirname,\n      \"./fixtures/html-template-with-image.html\",\n    );\n    const config = {\n      mode: \"development\",\n      entry: path.join(__dirname, \"fixtures/index.js\"),\n      output: {\n        assetModuleFilename: \"[name][ext]\",\n        path: outputPath,\n      },\n      module: {\n        rules: [\n          {\n            test: /\\.html$/,\n            loader: \"html-loader\",\n          },\n        ],\n      },\n      plugins: [\n        new HtmlWebpackPlugin({\n          favicon: path.join(__dirname, \"./fixtures/favicon.ico\"),\n          template,\n        }),\n      ],\n    };\n\n    const templateContent = fs.readFileSync(template, \"utf-8\");\n    const compiler = new WebpackRecompilationSimulator(webpack(config));\n    fs.mkdirSync(outputPath, { recursive: true });\n    const jsFileTempPath = compiler.addTestFile(\n      path.join(__dirname, \"fixtures/index.js\"),\n    );\n    const expected = [\"logo.png\", \"main.js\", \"favicon.ico\", \"index.html\"];\n\n    return (\n      compiler\n        .startWatching()\n        // Change the template file and compile again\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(\n            jsFileTempPath,\n            \"module.exports = function calc(a, b){ return a - b };\",\n          );\n\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(\n            template,\n            templateContent.replace(\n              /Some unique text/,\n              \"Some other unique text\",\n            ),\n          );\n\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(template, templateContent);\n        })\n        .then(() => compiler.stopWatching())\n    );\n  });\n\n  it(\"should re-emit favicon and assets from a loader if watch is active and clean enabled\", () => {\n    const expected = [\"logo.png\", \"main.js\", \"favicon.ico\", \"index.html\"];\n\n    class MyPlugin {\n      apply(compiler) {\n        compiler.hooks.thisCompilation.tap(\n          { name: this.constructor.name },\n          (compilation) => {\n            return compilation.hooks.processAssets.tap(\n              {\n                name: this.constructor.name,\n                stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ANALYSE,\n              },\n              (assets) => {\n                expect(\n                  expected.every((val) => Object.keys(assets).includes(val)),\n                ).toBe(true);\n              },\n            );\n          },\n        );\n      }\n    }\n\n    const outputPath = path.join(OUTPUT_DIR, \"four\");\n    const template = path.join(\n      __dirname,\n      \"./fixtures/html-template-with-image.html\",\n    );\n    const config = {\n      mode: \"development\",\n      entry: path.join(__dirname, \"fixtures/index.js\"),\n      output: {\n        clean: true,\n        assetModuleFilename: \"[name][ext]\",\n        path: outputPath,\n      },\n      module: {\n        rules: [\n          {\n            test: /\\.html$/,\n            loader: \"html-loader\",\n          },\n        ],\n      },\n      plugins: [\n        new HtmlWebpackPlugin({\n          favicon: path.join(__dirname, \"./fixtures/favicon.ico\"),\n          template,\n        }),\n        new MyPlugin(),\n      ],\n    };\n\n    const templateContent = fs.readFileSync(template, \"utf-8\");\n    const compiler = new WebpackRecompilationSimulator(webpack(config));\n    fs.mkdirSync(outputPath, { recursive: true });\n    const jsFileTempPath = compiler.addTestFile(\n      path.join(__dirname, \"fixtures/index.js\"),\n    );\n\n    return (\n      compiler\n        .startWatching()\n        // Change the template file and compile again\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(\n            jsFileTempPath,\n            \"module.exports = function calc(a, b){ return a - b };\",\n          );\n\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(\n            template,\n            templateContent.replace(\n              /Some unique text/,\n              \"Some other unique text\",\n            ),\n          );\n\n          return compiler.waitForWatchRunComplete();\n        })\n        .then((stats) => {\n          expect(\n            expected.every((val) =>\n              Object.keys(stats.compilation.assets).includes(val),\n            ),\n          ).toBe(true);\n          expect(stats.compilation.errors).toEqual([]);\n          expect(stats.compilation.warnings).toEqual([]);\n\n          fs.writeFileSync(template, templateContent);\n        })\n        .then(() => compiler.stopWatching())\n    );\n  });\n});\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    \"allowJs\": true /* Allow javascript files to be compiled. */,\n    \"checkJs\": true /* Report errors in .js files. */,\n    \"noEmit\": true /* Do not emit outputs. */,\n    \"lib\": [\"es2017\"],\n\n    /* Strict Type-Checking Options */\n    \"strict\": true /* Enable all strict type-checking options. */,\n    \"noImplicitAny\": false /* Raise error on expressions and declarations with an implied 'any' type. */,\n    // \"strictNullChecks\": true,              /* Enable strict null checks. */\n    // \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n    // \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n    // \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n    // \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    // \"noUnusedLocals\": true,                /* Report errors on unused locals. */\n    // \"noUnusedParameters\": true,            /* Report errors on unused parameters. */\n    // \"noImplicitReturns\": true,             /* Report error when not all code paths in function return a value. */\n    // \"noFallthroughCasesInSwitch\": true,    /* Report errors for fallthrough cases in switch statement. */\n\n    /* Module Resolution Options */\n    \"moduleResolution\": \"node\" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,\n    \"allowSyntheticDefaultImports\": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,\n    \"esModuleInterop\": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"useUnknownInCatchVariables\": false\n  },\n  \"types\": [\"node\"],\n  \"exclude\": [\"node_modules\", \"spec\", \"examples\", \"dist\", \"coverage\"]\n}\n"
  },
  {
    "path": "typings.d.ts",
    "content": "import { AsyncSeriesWaterfallHook } from \"tapable\";\nimport { Compiler, Compilation } from \"webpack\";\nimport { Options as HtmlMinifierOptions } from \"html-minifier-terser\";\n\nexport = HtmlWebpackPlugin;\n\ndeclare class HtmlWebpackPlugin {\n  constructor(options?: HtmlWebpackPlugin.Options);\n\n  userOptions: HtmlWebpackPlugin.Options;\n\n  /** Current HtmlWebpackPlugin Major */\n  version: number;\n\n  /**\n   * Options after html-webpack-plugin has been initialized with defaults\n   */\n  options?: HtmlWebpackPlugin.ProcessedOptions;\n\n  apply(compiler: Compiler): void;\n\n  static getHooks(compilation: Compilation): HtmlWebpackPlugin.Hooks;\n  static getCompilationHooks(compilation: Compilation): HtmlWebpackPlugin.Hooks;\n\n  /**\n   * Static helper to create a tag object to be get injected into the dom\n   */\n  static createHtmlTagObject(\n    tagName: string,\n    attributes?: { [attributeName: string]: string | boolean },\n    innerHTML?: string,\n  ): HtmlWebpackPlugin.HtmlTagObject;\n\n  static readonly version: number;\n}\n\ndeclare namespace HtmlWebpackPlugin {\n  type MinifyOptions = HtmlMinifierOptions;\n\n  interface Options {\n    /**\n     * Emit the file only if it was changed.\n     * @default true\n     */\n    cache?: boolean;\n    /**\n     * List all entries which should be injected\n     */\n    chunks?: \"all\" | string[];\n    /**\n     * Allows to control how chunks should be sorted before they are included to the html.\n     * @default 'auto'\n     */\n    chunksSortMode?:\n      | \"auto\"\n      // `none` is deprecated and an alias for `auto` now.\n      | \"none\"\n      | \"manual\"\n      | ((entryNameA: string, entryNameB: string) => number);\n    /**\n     * List all entries which should not be injected\n     */\n    excludeChunks?: string[];\n    /**\n     * Path to the favicon icon\n     */\n    favicon?: false | string;\n    /**\n     * The file to write the HTML to.\n     * Supports subdirectories eg: `assets/admin.html`\n     * [name] will be replaced by the entry name\n     * Supports a function to generate the name\n     *\n     * @default 'index.html'\n     */\n    filename?: string | ((entryName: string) => string);\n    /**\n     * By default the public path is set to `auto` - that way the html-webpack-plugin will try\n     * to set the publicPath according to the current filename and the webpack publicPath setting\n     */\n    publicPath?: string | \"auto\";\n    /**\n     * If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files.\n     * This is useful for cache busting\n     */\n    hash?: boolean;\n    /**\n     * Inject all assets into the given `template` or `templateContent`.\n     */\n    inject?:\n      | false // Don't inject scripts\n      | true // Inject scripts into body\n      | \"body\" // Inject scripts into body\n      | \"head\"; // Inject scripts into head\n    /**\n     * Set up script loading\n     * blocking will result in <script src=\"...\"></script>\n     * defer will result in <script defer src=\"...\"></script>\n     *\n     * @default 'defer'\n     */\n    scriptLoading?: \"blocking\" | \"defer\" | \"module\" | \"systemjs-module\";\n    /**\n     * Inject meta tags\n     */\n    meta?:\n      | false // Disable injection\n      | {\n          [name: string]:\n            | string\n            | false // name content pair e.g. {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`\n            | { [attributeName: string]: string | boolean }; // custom properties e.g. { name:\"viewport\" content:\"width=500, initial-scale=1\" }\n        };\n    /**\n     * HTML Minification options accepts the following values:\n     * - Set to `false` to disable minification\n     * - Set to `'auto'` to enable minification only for production mode\n     * - Set to custom minification according to\n     * {@link https://github.com/kangax/html-minifier#options-quick-reference}\n     */\n    minify?: \"auto\" | boolean | MinifyOptions;\n    /**\n     * Render errors into the HTML page\n     */\n    showErrors?: boolean;\n    /**\n     * The `webpack` require path to the template.\n     * @see https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md\n     */\n    template?: string;\n    /**\n     * Allow to use a html string instead of reading from a file\n     */\n    templateContent?:\n      | false // Use the template option instead to load a file\n      | string\n      | ((templateParameters: {\n          [option: string]: any;\n        }) => string | Promise<string>)\n      | Promise<string>;\n    /**\n     * Allows to overwrite the parameters used in the template\n     */\n    templateParameters?:\n      | false // Pass an empty object to the template function\n      | ((\n          compilation: Compilation,\n          assets: {\n            publicPath: string;\n            js: Array<string>;\n            css: Array<string>;\n            manifest?: string;\n            favicon?: string;\n          },\n          assetTags: {\n            headTags: HtmlTagObject[];\n            bodyTags: HtmlTagObject[];\n          },\n          options: ProcessedOptions,\n        ) => { [option: string]: any } | Promise<{ [option: string]: any }>)\n      | { [option: string]: any };\n    /**\n     * The title to use for the generated HTML document\n     */\n    title?: string;\n    /**\n     * Enforce self closing tags e.g. <link />\n     */\n    xhtml?: boolean;\n    /**\n     * In addition to the options actually used by this plugin, you can use this hash to pass arbitrary data through\n     * to your template.\n     */\n    [option: string]: any;\n  }\n\n  /**\n   * The plugin options after adding default values\n   */\n  interface ProcessedOptions extends Required<Options> {\n    filename: string;\n  }\n\n  /**\n   * The values which are available during template execution\n   *\n   * Please keep in mind that the `templateParameter` options allows to change them\n   */\n  interface TemplateParameter {\n    compilation: Compilation;\n    htmlWebpackPlugin: {\n      tags: {\n        headTags: HtmlTagObject[];\n        bodyTags: HtmlTagObject[];\n      };\n      files: {\n        publicPath: string;\n        js: Array<string>;\n        css: Array<string>;\n        manifest?: string;\n        favicon?: string;\n      };\n      options: Options;\n    };\n    webpackConfig: any;\n  }\n\n  interface Hooks {\n    alterAssetTags: AsyncSeriesWaterfallHook<{\n      assetTags: {\n        scripts: HtmlTagObject[];\n        styles: HtmlTagObject[];\n        meta: HtmlTagObject[];\n      };\n      publicPath: string;\n      outputName: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n\n    alterAssetTagGroups: AsyncSeriesWaterfallHook<{\n      headTags: HtmlTagObject[];\n      bodyTags: HtmlTagObject[];\n      outputName: string;\n      publicPath: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n\n    afterTemplateExecution: AsyncSeriesWaterfallHook<{\n      html: string;\n      headTags: HtmlTagObject[];\n      bodyTags: HtmlTagObject[];\n      outputName: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n\n    beforeAssetTagGeneration: AsyncSeriesWaterfallHook<{\n      assets: {\n        publicPath: string;\n        js: Array<string>;\n        css: Array<string>;\n        favicon?: string;\n        manifest?: string;\n      };\n      outputName: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n\n    beforeEmit: AsyncSeriesWaterfallHook<{\n      html: string;\n      outputName: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n\n    afterEmit: AsyncSeriesWaterfallHook<{\n      outputName: string;\n      plugin: HtmlWebpackPlugin;\n    }>;\n  }\n\n  /**\n   * A tag element according to the htmlWebpackPlugin object notation\n   */\n  interface HtmlTagObject {\n    /**\n     * Attributes of the html tag\n     * E.g. `{'disabled': true, 'value': 'demo'}`\n     */\n    attributes: {\n      [attributeName: string]: string | boolean | null | undefined;\n    };\n    /**\n     * The tag name e.g. `'div'`\n     */\n    tagName: string;\n    /**\n     * The inner HTML\n     */\n    innerHTML?: string;\n    /**\n     * Whether this html must not contain innerHTML\n     * @see https://www.w3.org/TR/html5/syntax.html#void-elements\n     */\n    voidTag: boolean;\n    /**\n     * Meta information about the tag\n     * E.g. `{'plugin': 'html-webpack-plugin'}`\n     */\n    meta: {\n      plugin?: string;\n      [metaAttributeName: string]: any;\n    };\n  }\n}\n"
  }
]