Showing preview only (484K chars total). Download the full file or copy to clipboard to get everything.
Repository: jantimon/html-webpack-plugin
Branch: main
Commit: 723ed41e05b6
Files: 187
Total size: 441.4 KB
Directory structure:
gitextract_5kqxl4xw/
├── .cspell.json
├── .editorconfig
├── .eslintrc.js
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── issue_template.md
│ ├── lock.yml
│ ├── stale.yml
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .husky/
│ ├── commit-msg
│ └── pre-commit
├── .mailmap
├── .node-version
├── .prettierignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── commitlint.config.js
├── default_index.ejs
├── docs/
│ └── template-option.md
├── examples/
│ ├── README.md
│ ├── build-examples.js
│ ├── chunk-optimization/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── 192.js
│ │ │ ├── 461.js
│ │ │ ├── entryA.html
│ │ │ ├── entryA.js
│ │ │ ├── entryB.html
│ │ │ ├── entryB.js
│ │ │ ├── entryC.html
│ │ │ ├── libMath.js
│ │ │ └── libText.js
│ │ ├── entryA.js
│ │ ├── entryB.js
│ │ ├── lib-concat.js
│ │ ├── lib-multiply.js
│ │ ├── lib-sum.js
│ │ ├── main.css
│ │ ├── readme.md
│ │ └── webpack.config.js
│ ├── custom-insertion-position/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ └── index.html
│ │ ├── example.js
│ │ ├── index.ejs
│ │ ├── readme.md
│ │ └── webpack.config.js
│ ├── custom-template/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── partial.html
│ │ ├── readme.md
│ │ ├── template.html
│ │ └── webpack.config.js
│ ├── default/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ └── index.html
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── readme.md
│ │ └── webpack.config.js
│ ├── favicon/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── favicon.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── template.html
│ │ └── webpack.config.js
│ ├── html-loader/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── about.html
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── template.html
│ │ └── webpack.config.js
│ ├── inline/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── readme.md
│ │ ├── template.pug
│ │ └── webpack.config.js
│ ├── javascript/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── partial.html
│ │ ├── readme.md
│ │ ├── template.js
│ │ ├── universal.js
│ │ └── webpack.config.js
│ ├── javascript-advanced/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── partial.html
│ │ ├── readme.md
│ │ ├── template.js
│ │ ├── universal.js
│ │ └── webpack.config.js
│ ├── multi-page/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── first.html
│ │ │ ├── first.js
│ │ │ ├── second.html
│ │ │ └── second.js
│ │ ├── first.js
│ │ ├── main.css
│ │ ├── readme.md
│ │ ├── second.js
│ │ └── webpack.config.js
│ ├── pug-loader/
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── bundle.js
│ │ │ ├── index.html
│ │ │ └── styles.css
│ │ ├── example.js
│ │ ├── main.css
│ │ ├── readme.md
│ │ ├── template.pug
│ │ ├── time.pug
│ │ └── webpack.config.js
│ ├── sort-manually/
│ │ ├── a.js
│ │ ├── b.js
│ │ ├── c.js
│ │ ├── d.js
│ │ ├── dist/
│ │ │ └── webpack-5/
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ ├── c.js
│ │ │ ├── d.js
│ │ │ ├── e.js
│ │ │ ├── first-file.html
│ │ │ ├── second-file.html
│ │ │ └── styles.css
│ │ ├── e.js
│ │ ├── main.css
│ │ ├── template.html
│ │ └── webpack.config.js
│ └── template-parameters/
│ ├── dist/
│ │ └── webpack-5/
│ │ ├── bundle.js
│ │ └── index.html
│ ├── example.js
│ ├── index.ejs
│ ├── readme.md
│ └── webpack.config.js
├── flow.puml
├── index.js
├── lib/
│ ├── cached-child-compiler.js
│ ├── child-compiler.js
│ ├── chunksorter.js
│ ├── errors.js
│ ├── hooks.js
│ ├── html-tags.js
│ └── loader.js
├── lint-staged.config.js
├── logs
├── migration.md
├── package.json
├── spec/
│ ├── basic.spec.js
│ ├── caching.spec.js
│ ├── example.spec.js
│ ├── fixtures/
│ │ ├── async.js
│ │ ├── common.js
│ │ ├── empty.html
│ │ ├── empty_html.html
│ │ ├── html-template-with-image.html
│ │ ├── index.js
│ │ ├── interpolation.html
│ │ ├── invalid.html
│ │ ├── logo.html
│ │ ├── main.css
│ │ ├── plain.html
│ │ ├── spaced_plain.html
│ │ ├── src/
│ │ │ └── index.ejs
│ │ ├── template-partial.hbs
│ │ ├── template.ejs
│ │ ├── template.hbs
│ │ ├── template.pug
│ │ ├── templateParam.cjs
│ │ ├── templateParam.js
│ │ ├── test.html
│ │ ├── theme.js
│ │ ├── util.js
│ │ └── webpackconfig.html
│ └── hot.spec.js
├── tsconfig.json
└── typings.d.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .cspell.json
================================================
{
"version": "0.2",
"language": "en,en-gb",
"words": [
"commitlint",
"chunkhash",
"concat",
"systemjs",
"tapable",
"templatehash",
"blueimp",
"selfclosed",
"nocheck",
"iife",
"appcache",
"subresource",
"startuml",
"autonumber",
"enduml",
"chunksorter",
"urlencode",
"sortmode",
"harddisk",
"Sileghem",
"Bname",
"Bfile",
"webpackconfig",
"specialattribute",
"dircompare",
"wagoid",
"autocrlf"
],
"ignorePaths": [
"CHANGELOG.md",
"coverage",
"package.json",
"**/dist/**",
"**/__snapshots__/**",
"**/fixtures/**",
"package-lock.json",
"node_modules",
"coverage",
"*.log"
]
}
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
================================================
FILE: .eslintrc.js
================================================
module.exports = {
env: {
node: true,
commonjs: true,
es2021: true,
},
extends: "eslint:recommended",
ignorePatterns: ["**/dist/**/*.js", "**/spec/fixtures/**/*.js"],
overrides: [
{
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
{
env: {
browser: true,
es2021: true,
},
files: ["**/examples/**"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
},
rules: {},
};
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: html-webpack-plugin
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a 🕷 report to help us improve
---
<!-- If you deleting this template this issue is very likely to be closed -->
## Current behaviour 💣
<!-- Tell us which problem you are facing which might be caused by a bug in the html-webpack-plugin -->
## Expected behaviour ☀️
<!-- If not included in current behaviour please explain what should happen instead -->
### Reproduction Example 👾
<!--
Please provide a minimal example how to reproduce your problem..
Delete all plugins which are unrelated
Delete all loaders which are unrelated
Delete the production webpack config if your bug happens on develop
Delete the develop webpack config if your bug happens only on production
Feel free to use this codebox template as a starting point: https://codesandbox.io/s/html-webpack-plugin-5x-alpha-d37s2?file=/webpack.config.js
-->
## Environment 🖥
<!--
To help you we need to know which versions you using otherwise it is impossible to help you.
Please run the following commands to see your current versions:
```
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
npm --version
npm ls webpack
npm ls html-webpack-plugin
```
-->
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/issue_template.md
================================================
<!-- CLICK "Preview" FOR INSTRUCTIONS IN A MORE READABLE FORMAT -->
## Prerequisites
- 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.
- Support questions are better asked in one of the following locations:
- [Stack Overflow](http://stackoverflow.com/questions/tagged/html-webpack-plugin)
- Ensure the issue isn't already reported.
- Should be reproducible with the latest version of `html-webpack-plugin`.
- (Ensure `npm ls html-webpack-plugin` matches )
_Delete the above section and the instructions in the sections below before submitting_
## Description
If this is a feature request, explain why it should be added. Specific use-cases are best.
For bug reports, please provide as much _relevant_ info as possible.
### Error Message & Stack Trace
```
COPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE
```
### Config
Copy the relevant section from `webpack.config.js`:
```js
module.exports = {
entry: 'app.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
module: {
rules: [
...
]
}
plugins: [
new HtmlWebpackPlugin(),
...
]
}
```
Copy your template file:
```html
<!doctype html>
<html>
<head>
<title>My App</title>
</head>
<body></body>
</html>
```
## Relevant Links
- If your project is public, link to the repo so we can investigate directly.
- **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support.
## Environment
Tell 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:
```
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
npm --version
npm ls webpack
npm ls html-webpack-plugin
```
================================================
FILE: .github/lock.yml
================================================
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
exemptLabels: []
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: false
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 30
================================================
FILE: .github/stale.yml
================================================
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 180
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 15
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
**This issue had no activity for at least half a year.**
It's subject to automatic issue closing if there is no activity in the next 15 days.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
================================================
FILE: .github/workflows/main.yml
================================================
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [lts/*]
runs-on: ${{ matrix.os }}
concurrency:
group: lint-${{ matrix.os }}-v${{ matrix.node-version }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Lint
run: npm run lint
- name: Security audit
run: npm run security -- --only=prod
- name: Check commit message
uses: wagoid/commitlint-github-action@v5
build:
name: test Node ${{ matrix.node }} Webpack ${{ matrix.webpack }} ${{ matrix.os }}
timeout-minutes: 15
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ matrix.os }}-v${{ matrix.node }}-${{ matrix.webpack }}-${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
node:
[
"10.x",
"12.x",
"14.x",
"16.x",
"18.x",
"20.x",
"22.x",
"24.x",
"25.x",
]
os: [ubuntu-latest, windows-latest, macOS-latest]
webpack: [latest]
steps:
- name: Setup Git
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf input
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Install webpack ${{ matrix.webpack-version }}
if: matrix.webpack-version != 'latest'
run: npm i webpack@${{ matrix.webpack-version }} --legacy-peer-deps
- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: npm run test:coverage -- --ci
- name: Submit coverage data to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
================================================
FILE: .gitignore
================================================
/node_modules/
/dist/
/coverage/
npm-debug.*.log
yarn.lock
npm-debug.log.*
/.idea/
.eslintcache
.cspellcache
================================================
FILE: .husky/commit-msg
================================================
npx --no-install commitlint --edit $1
================================================
FILE: .husky/pre-commit
================================================
npx --no-install lint-staged
================================================
FILE: .mailmap
================================================
Chris Greening <chris@cmgresearch.com>
Jan Nicklas <j.nicklas@me.com>
Jan Nicklas <j.nicklas@me.com> <j.nicklas@sinnerschrader.com>
Ma Cheng <mc@mc-zone.me>
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Thomas Grainger <tom.grainger@procensus.com>
Thomas Grainger <tom.grainger@procensus.com> <tagrain@gmail.com>
Zhanwei Wu <zhanwei.wu@dbjtech.com>
================================================
FILE: .node-version
================================================
10.13.0
================================================
FILE: .prettierignore
================================================
/coverage
/dist
/node_modules
/spec/fixtures
CHANGELOG.md
examples/*/dist
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [5.6.6](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.5...v5.6.6) (2026-01-16)
### Bug Fixes
* compatibility with handlebars-loader ([#1882](https://github.com/jantimon/html-webpack-plugin/issues/1882)) ([a8e563b](https://github.com/jantimon/html-webpack-plugin/commit/a8e563b9872e98193ebca75a886fc2657711e722))
### [5.6.5](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.4...v5.6.5) (2025-11-18)
### Bug Fixes
* 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))
### [5.6.4](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.3...v5.6.4) (2025-08-14)
### Bug Fixes
* 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))
### [5.6.3](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.2...v5.6.3) (2024-10-23)
### Bug Fixes
* 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))
### [5.6.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.1...v5.6.2) (2024-10-17)
### Bug Fixes
* allow bundle empty html ([#1865](https://github.com/jantimon/html-webpack-plugin/issues/1865)) ([f5b9140](https://github.com/jantimon/html-webpack-plugin/commit/f5b9140cc3232cb695453d8e5f3140a5af59acc8))
### [5.6.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.6.0...v5.6.1) (2024-10-17)
### Bug Fixes
* 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))
* don't use `initialize` hooks to allow dynamic plugin injection ([ae85878](https://github.com/jantimon/html-webpack-plugin/commit/ae85878c3812b72d891ce368d81ce05b72c3748e))
* 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))
## [5.6.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.4...v5.6.0) (2023-12-19)
### Features
* 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))
* 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))
### Bug Fixes
* memory leak ([#1836](https://github.com/jantimon/html-webpack-plugin/issues/1836)) ([c79f2cf](https://github.com/jantimon/html-webpack-plugin/commit/c79f2cfdb3aaa6f1dbd87b64c7d13bc9ab21c59f))
### [5.5.4](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.3...v5.5.4) (2023-12-06)
### Bug Fixes
* 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))
* reemit assets from loaders ([#1811](https://github.com/jantimon/html-webpack-plugin/issues/1811)) ([a214736](https://github.com/jantimon/html-webpack-plugin/commit/a21473675c81dc4ac2ec8112741cbd52a2756dcc))
* 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))
### [5.5.3](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.2...v5.5.3) (2023-06-10)
### Bug Fixes
* 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))
* 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))
* **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))
### [5.5.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.1...v5.5.2) (2023-06-08)
### Bug Fixes
* 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))
### [5.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.5.0...v5.5.1) (2023-04-15)
### Bug Fixes
* **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))
## [5.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.4.0...v5.5.0) (2021-10-25)
### Features
* 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)
### [5.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.2...v5.3.3) (2021-10-15)
### Features
* update terser ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/pull/1688)
### [5.3.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.1...v5.3.2) (2021-06-22)
### Bug Fixes
* update lodash and pretty error ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/commit/9c7fba02d0aa7d9e804863a66eb896db3046f645)
### [5.3.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.0...v5.3.1) (2021-03-09)
### Bug Fixes
* remove loader-utils from plugin core ([82d0ee8](https://github.com/jantimon/html-webpack-plugin/commit/82d0ee8ddf146f17d71e98c1b44b2f2ec7420051))
## [5.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.2.0...v5.3.0) (2021-03-07)
### Features
* allow to modify the interpolation options in webpack config ([d654f5b](https://github.com/jantimon/html-webpack-plugin/commit/d654f5b90022304335b372d424ff4c08d3a9d341))
* drop loader-utils dependency ([41d7a50](https://github.com/jantimon/html-webpack-plugin/commit/41d7a50516aefd1af2704e3837d5d41351c6199b))
## [5.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.1.0...v5.2.0) (2021-02-19)
### Features
* improve ssr ([73d2a66](https://github.com/jantimon/html-webpack-plugin/commit/73d2a660b10b9ebf8a341f0ddb173bcaaf1e513c))
## [5.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.0.0...v5.1.0) (2021-02-12)
### Features
* 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)
## [5.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v5.0.0) (2021-02-03)
### ⚠ BREAKING CHANGES
* Drop support for `webpack` 4 and `node` <= 10 - For older webpack or node versions please use `html-webpack-plugin` 4.x
* 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
* 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
* Plugins for `html-webpack-plugin` which add additional assetTags should provide a `meta` attribute
* Drop support for `appcache-webpack-plugin`
### Features
* drop `webpack` 4 and `node` <= 10 support to make use of the latest APIs ([b7a9e8f](https://github.com/jantimon/html-webpack-plugin/commit/b7a9e8f2a3c146cfec8f5c42888abd6aa0cde0b9))
* 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))
* 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))
* the `filename` option can now be a function ([c5beb4b](https://github.com/jantimon/html-webpack-plugin/commit/c5beb4bd16e4916b5355c300abebf9d7d3c587da))
* 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))
* use defer as default script loading mechanism ([35b6b87](https://github.com/jantimon/html-webpack-plugin/commit/35b6b878db17f0f5704a187b336a14fdd58cedfc))
* allow to set publicPath to an empty string `''` ([5ea7de4](https://github.com/jantimon/html-webpack-plugin/commit/5ea7de4ba271813835be700316c8a1763b205d2d))
* improve typings ([197ddd8](https://github.com/jantimon/html-webpack-plugin/commit/197ddd88f39a2e6e70863b6fed2385d33043d137))
* provide public path to the alterAssetTagGroups hook ([1b54dfb](https://github.com/jantimon/html-webpack-plugin/commit/1b54dfbd62c0d0df10dd3d2be9937626142d518f))
* provide public path to the alterAssetTags hook ([b754626](https://github.com/jantimon/html-webpack-plugin/commit/b75462653d11803a428b1d29479e259c3010163f))
* use `thisCompilation` in child compiler for faster builds ([1d59e9a](https://github.com/jantimon/html-webpack-plugin/commit/1d59e9a71ddba1429168c42569a7bd9bdd363f4f))
* export new major in static property ([8b692bd](https://github.com/jantimon/html-webpack-plugin/commit/8b692bd7cc0b75ddf55f47da317eed9bd19dab91))
* reduce dependencies ([8c28aaa](https://github.com/jantimon/html-webpack-plugin/commit/8c28aaa2bed5a7147b397fef3801cfe8fb5c34b9), [56e633f](https://github.com/jantimon/html-webpack-plugin/commit/56e633fcb90909c2bbedbd63590ecaa825d8b31f))
### Bug Fixes
* emit files on every build to work properly with plugins like the
clean-webpack-plugin ([6b3d087](https://github.com/jantimon/html-webpack-plugin/commit/6b3d087cf17f63b596c298d70a42a7462dd0f881))
* generate html files even if no webpack entry exists ([2693dfa](https://github.com/jantimon/html-webpack-plugin/commit/2693dfaf4c94625eab86afadfd0e4d8822092d6b))
* 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)
## [4.5.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v4.5.2) (2021-02-18)
### Bug Fixes
* more robust variable value extraction to add support for webpack >= 5.22.0 ([1aabaf9](https://github.com/jantimon/html-webpack-plugin/commit/1aabaf99820257cbe7d3efccb62b42254ad35e04))
### [4.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.0...v4.5.1) (2021-01-03)
### Bug Fixes
* inject javascripts in the <head> tag for inject:true and scriptLoading:'defer' ([4f7064e](https://github.com/jantimon/html-webpack-plugin/commit/4f7064ee56fe710e8f416018956647a72c270fb1))
# [4.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.1...v4.5.0) (2020-09-21)
### Features
* 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))
* 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)
## [4.4.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.0...v4.4.1) (2020-08-30)
### Bug Fixes
* 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))
# [4.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.3.0...v4.4.0) (2020-08-30)
### Bug Fixes
* fix typos in comments ([#1484](https://github.com/jantimon/html-webpack-plugin/issues/1484)) ([6b0711e](https://github.com/jantimon/html-webpack-plugin/commit/6b0711e))
### Features
* 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)
# [4.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.2...v4.3.0) (2020-04-30)
### Features
* Allow to use console.log inside templates ([c3f2fdc](https://github.com/jantimon/html-webpack-plugin/commit/c3f2fdc))
## [4.2.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.1...v4.2.2) (2020-04-30)
### Bug Fixes
* Prevent "cannot read property info of undefined" when reading meta information from assets ([253ce30](https://github.com/jantimon/html-webpack-plugin/commit/253ce30))
* use modern icon tag rel attribute for favicons ([c40dd85](https://github.com/jantimon/html-webpack-plugin/commit/c40dd85))
## [4.2.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.0...v4.2.1) (2020-04-28)
### Bug Fixes
* don't add dependencies twice to the webpack 5 watcher api ([ceafe14](https://github.com/jantimon/html-webpack-plugin/commit/ceafe143650749a5f53a14411dc1b762e252ec44))
* prevent scripts marked as hotModuleReplacement from being added to the html file ([119252a](https://github.com/jantimon/html-webpack-plugin/commit/119252a381bf43dea37c1be64f90c10bebc21302))
# [4.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.1.0...v4.2.0) (2020-04-09)
### Features
* Add template content ([#1401](https://github.com/jantimon/html-webpack-plugin/issues/1401)) ([4740bf7](https://github.com/jantimon/html-webpack-plugin/commit/4740bf7))
# [4.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.4...v4.1.0) (2020-04-09)
### Features
* Add webpack 5 support ([39c38a4](https://github.com/jantimon/html-webpack-plugin/commit/39c38a4))
* Allow webpack 5 as peer dependency ([9c571e2](https://github.com/jantimon/html-webpack-plugin/commit/9c571e2))
## [4.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.3...v4.0.4) (2020-04-01)
### Bug Fixes
* 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)
## [4.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.2...v4.0.3) (2020-03-28)
### Bug Fixes
* add webpack, tapable and html-minifier-terser as dependencies because of types.d.ts ([238da81](https://github.com/jantimon/html-webpack-plugin/commit/238da8123950f87267954fd448f3e6b0fb1ead17))
## [4.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.1...v4.0.2) (2020-03-26)
### Bug Fixes
* don't remove trailing slashes from self closing tags by default ([2281e4b](https://github.com/jantimon/html-webpack-plugin/commit/2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e))
## [4.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.0...v4.0.1) (2020-03-23)
### Bug Fixes
* update typedefs to match with html-minifier-terser ([2698c7e](https://github.com/jantimon/html-webpack-plugin/commit/2698c7e45a7f12113a07b256dc400ec89666130d))
# [4.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.0) (2020-03-23)
The summary can be found in the [**release blog post**](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d).
### Bug Fixes
* Add dependencies from the child compilation to the main compilation ([27c3e72](https://github.com/jantimon/html-webpack-plugin/commit/27c3e727b073701bfc739859d8325435d27cbf35))
* 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))
* 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)
* 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)
* Drop @types/webpack dependency ([d4eb1c7](https://github.com/jantimon/html-webpack-plugin/commit/d4eb1c749316af3964126606fe6c70a233c30fef))
* Ignore foreign child compilers ([1422664](https://github.com/jantimon/html-webpack-plugin/commit/14226649aa1bbaf7b174bcacafdbe47d8ba6c851))
* Improve perfomance for appcache files ([b94e043](https://github.com/jantimon/html-webpack-plugin/commit/b94e0434f5dbb06ee2179e91ebaa2ce7801937e0))
* load script files before style files files in defer script loading mode ([97f9fb9](https://github.com/jantimon/html-webpack-plugin/commit/97f9fb9a68e4d3c3c9453296c352e831f7546937))
* Prevent chunks from beeing added multiple times ([d65b37d](https://github.com/jantimon/html-webpack-plugin/commit/d65b37d2c588047e0d81a38f4645fcdb3ead0b9e))
* 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)
* Remove compilation.getStats() call for performance reasons ([7005a55](https://github.com/jantimon/html-webpack-plugin/commit/7005a557529bee948c5ef0a1b8b44a1a41a28417))
* 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))
* 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)
* **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)
* rename `contenthash` to `templatehash` ([4c11c5d](https://github.com/jantimon/html-webpack-plugin/commit/4c11c5dfde9d87d71dce9cf51864648f8e42b912))
* Repair typings ([#1166](https://github.com/jantimon/html-webpack-plugin/issues/1166)) ([f4cb241](https://github.com/jantimon/html-webpack-plugin/commit/f4cb241157a9a1fed4721b1abc1f390b09595494))
* 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))
* 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))
* **chunksorter:** Don't sort chunks by default ([22fb03f](https://github.com/jantimon/html-webpack-plugin/commit/22fb03fb17fdb37d5ce6de00af154b5575a02d3a))
* **loader:** switch to loaderUtils.getOptions ([a0a0f0d](https://github.com/jantimon/html-webpack-plugin/commit/a0a0f0dc755fbc3249aa2e1d1c6a4dd307ab8e8a))
* **README:** adds a link to template option documentation ([f40aeae](https://github.com/jantimon/html-webpack-plugin/commit/f40aeae312af73c6c5263cd99e81069f41d3b699))
* **tests:** Upgrade webpack-recompilation-simulator ([dfe1d10](https://github.com/jantimon/html-webpack-plugin/commit/dfe1d10c4511b0da4354cacf79ca0d5ac7baf862))
* Update lodash to 4.17.10 ([cc3bf49](https://github.com/jantimon/html-webpack-plugin/commit/cc3bf4909605879993c22e3048ee520dbdc8fa49))
### Code Refactoring
* Change the structure of the internal assets object ([37db086](https://github.com/jantimon/html-webpack-plugin/commit/37db0868efdbf334a1b60003fe5bd376cfd8ae01))
* 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))
* Use Webpack 4 APIs ([47efdea](https://github.com/jantimon/html-webpack-plugin/commit/47efdeaf17806f7d4e26aefacc748a92077f904a))
### Features
* add `.toString` implementation to htmlTags to allow easier rendering ([34d8aa5](https://github.com/jantimon/html-webpack-plugin/commit/34d8aa572c7acc59c26f3b5d15bf489a07aa4c24))
* 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)
* Add defer script loading ([de315eb](https://github.com/jantimon/html-webpack-plugin/commit/de315eb98497f3e5f517d59dbbe120b48c9b8db9))
* Add support for relative publicPath ([dbbdd81](https://github.com/jantimon/html-webpack-plugin/commit/dbbdd81de570dd181ea0905a6445fdeb5a784912))
* 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))
* 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)
* Add support for the [contenthash] placeholder inside htm file names ([ae8233a](https://github.com/jantimon/html-webpack-plugin/commit/ae8233a04d4105b6e970feaa2c5e11c0b48fd4b7))
* 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)
* Allow to return async template parameters ([99f9362](https://github.com/jantimon/html-webpack-plugin/commit/99f9362703055baf0029b8852cb5339b6218829d))
* 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))
* Export major version of this plugin ([6ae6f48](https://github.com/jantimon/html-webpack-plugin/commit/6ae6f48ecf92b080809d68092ee8c6825edfe5a4))
* merge templateParameters with default template parameters ([1d66e53](https://github.com/jantimon/html-webpack-plugin/commit/1d66e5333bc2aeb8caadf96e572af756d3708d19))
* Provide a verbose error message if html minification failed ([7df269f](https://github.com/jantimon/html-webpack-plugin/commit/7df269fd2a840d0800cb259bd559edb0b766e7ab))
* **compiler:** Add file dependencies ([bbc07a3](https://github.com/jantimon/html-webpack-plugin/commit/bbc07a3a214e3b693e6c9e3d6404e146a0fc023a))
* **compiler:** Use a single compiler for multiple plugin instances ([f29ae88](https://github.com/jantimon/html-webpack-plugin/commit/f29ae886d7fad50e7fbb78ac7ff7d5bd9bc47f49))
* **compiler:** Use timestamps to verify cache validity ([0ebcd17](https://github.com/jantimon/html-webpack-plugin/commit/0ebcd1776132262b799f2814659f4d90c3f3c1b3))
* Remove selfClosingTag ([5d3d8e4](https://github.com/jantimon/html-webpack-plugin/commit/5d3d8e4b73b7b97dba8bdf5fe1ecf50598040b54))
* Remove type="text/javascript" from injected script tags ([b46bf67](https://github.com/jantimon/html-webpack-plugin/commit/b46bf67ae4492a12b60c42c7d26831e480522b49))
* Replace jade with pug in examples ([d7ec407](https://github.com/jantimon/html-webpack-plugin/commit/d7ec4078c85b3ed9c2ff84e10fe75392f26a6130))
* Switch from jasmine to jest ([ae1f435](https://github.com/jantimon/html-webpack-plugin/commit/ae1f43527945c8ae953c2ba549631f2d090e003a))
* **hooks:** Add a helper for easier hook access ([b6dec4b](https://github.com/jantimon/html-webpack-plugin/commit/b6dec4bf1072509282756e8d83ef6ee447485f3a))
* **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))
* Simplify <meta> element and charset attribute ([55313be](https://github.com/jantimon/html-webpack-plugin/commit/55313bee9b82ea79157085e48bba4fa2ebfef6a4))
* 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)
* Use jsdoc for static typing ([a6b8d2d](https://github.com/jantimon/html-webpack-plugin/commit/a6b8d2dcf3b1183d50589b869162b972ad32de4d))
* Use webpack 4 entries api to extract asset information ([342867e](https://github.com/jantimon/html-webpack-plugin/commit/342867e1edb7c2a8748b0aca396f160f0b13d42e))
* **html-tags:** Add a helper to create html-tags ([ee6a165](https://github.com/jantimon/html-webpack-plugin/commit/ee6a165425a6b47dff341fb651848ec5727d7f7e))
### BREAKING CHANGES
* **defaults:** Use src/index.ejs if no template option is set.
* **defaults:** The default template has now a predefined viewport meta tag
* **defaults:** The default meta utf-8 declaration was changed to <meta charset="utf-8"/>
* **hooks:** Renamed beforeHtmlGeneration hook to beforeAssetTagGeneration
* **hooks:** Renamed beforeHtmlProcessing hook to alterAssetTags
* **hooks:** Renamed afterHtmlProcessing hook to beforeEmit
* **hooks:** The html-webpack-plugin doesn't add its hooks to the compilation object anymore
* 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}`
* The mimetype information "text/javascript" is removed from all generated script
tags
* Remove selfClosingTag attribute
* Template strings inside templates are now disabled by default
* Dropped support for Webpack 1 - 3
* Template variable webpack was removed
* **chunksorter:** Chunks aren't sorted anymore by default
<a name="3.2.0"></a>
# [3.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.1.0...v3.2.0) (2018-04-03)
### Bug Fixes
* **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)
* **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)
### Features
* Add meta tag option ([a7d37ca](https://github.com/jantimon/html-webpack-plugin/commit/a7d37ca))
* 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)
<a name="3.1.0"></a>
# [3.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.8...v3.1.0) (2018-03-22)
### Features
* 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))
<a name="3.0.8"></a>
## [3.0.8](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.7...v3.0.8) (2018-03-22)
### Bug Fixes
* **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))
<a name="3.0.7"></a>
## [3.0.7](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.6...v3.0.7) (2018-03-19)
### Bug Fixes
* **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))
<a name="3.0.6"></a>
## [3.0.6](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.5...v3.0.6) (2018-03-06)
### Bug Fixes
* **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))
<a name="3.0.5"></a>
## [3.0.5](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.5) (2018-03-06)
### Bug Fixes
* **entries:** do not ignore JS if there is also CSS ([020b714](https://github.com/jantimon/html-webpack-plugin/commit/020b714))
* **entries:** Don't add css entries twice ([0348d6b](https://github.com/jantimon/html-webpack-plugin/commit/0348d6b))
* **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))
<a name="3.0.4"></a>
## [3.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.4) (2018-03-01)
### Bug Fixes
* **entries:** Don't add css entries twice ([e890f23](https://github.com/jantimon/html-webpack-plugin/commit/e890f23))
<a name="3.0.3"></a>
## [3.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.3) (2018-03-01)
### Refactor
* **performance:** Reduce the amount of chunk information gathered based on #825 ([06c59a7](https://github.com/jantimon/html-webpack-plugin/commit/06c59a7))
<a name="3.0.2"></a>
## [3.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.1...v3.0.2) (2018-03-01)
### Bug Fixes
* **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))
<a name="3.0.1"></a>
## [3.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.0...v3.0.1) (2018-03-01)
### Bug Fixes
* **package:** Remove the extract-text-webpack-plugin peer dependency ([57411a9](https://github.com/jantimon/html-webpack-plugin/commit/57411a9))
<a name="3.0.0"></a>
## [3.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v2.30.1...v3.0.0) (2018-28-02)
### Features
* Add support for the new [webpack tapable](https://github.com/webpack/tapable) to be compatible with webpack 4.x
* Remove bluebird dependency
### BREAKING CHANGES
* Similar to webpack 4.x the support for node versions older than 6 are no longer supported
<a name="2.30.1"></a>
## 2.30.1
* 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).
<a name="2.30.0"></a>
## 2.30.0
* Add manual sort
* Performance improvements ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723))
<a name="2.29.0"></a>
## 2.29.0
* Add support for Webpack 3
<a name="2.28.0"></a>
## 2.28.0
* Backport 3.x void tag for plugin authors
<a name="2.27.1"></a>
## 2.27.1
* Revert 2.25.0 loader resolving
<a name="2.27.0"></a>
## 2.27.0
* Fix a chunksorter webpack 2 issue ([#569](https://github.com/jantimon/html-webpack-plugin/pull/569))
* Fix template path resolving ([#542](https://github.com/jantimon/html-webpack-plugin/pull/542))
<a name="2.26.0"></a>
## 2.26.0
* Allow plugins to add attributes without values to the `<script>` and `<link>` tags
<a name="2.25.0"></a>
## 2.25.0
* Clearer loader output
* Add basic support for webpack 2
<a name="2.24.1"></a>
## 2.24.1
* Hide event deprecated warning of 'applyPluginsAsyncWaterfall' for html-webpack-plugin-after-emit and improve the warning message.
<a name="2.24.0"></a>
## 2.24.0
* Update dependencies
* Add deprecate warning for plugins not returning a result
* Add [path] for favicons
<a name="2.23.0"></a>
## 2.23.0
* Update dependencies
* Stop automated tests for webpack 2 beta because of [#401](https://github.com/jantimon/html-webpack-plugin/issues/401)
<a name="2.22.0"></a>
## 2.22.0
* Update dependencies
<a name="2.21.1"></a>
## 2.21.1
* Better error handling ([#354](https://github.com/jantimon/html-webpack-plugin/pull/354))
<a name="2.21.0"></a>
## 2.21.0
* Add `html-webpack-plugin-alter-asset-tags` event to allow plugins to adjust the script/link tags
<a name="2.20.0"></a>
## 2.20.0
* Exclude chunks works now even if combined with dependency sort
<a name="2.19.0"></a>
## 2.19.0
* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation
<a name="2.18.0"></a>
## 2.18.0
* Updated all dependencies
<a name="2.17.0"></a>
## 2.17.0
* Add `type` attribute to `script` element to prevent issues in Safari 9.1.1
<a name="2.16.2"></a>
## 2.16.2
* Fix bug introduced by 2.16.2. Fixes [#315](https://github.com/jantimon/html-webpack-plugin/issues/315)
<a name="2.16.1"></a>
## 2.16.1
* Fix hot module replacement for webpack 2.x
<a name="2.16.0"></a>
## 2.16.0
* Add support for dynamic filenames like index[hash].html
<a name="2.15.0"></a>
## 2.15.0
* Add full unit test coverage for the webpack 2 beta version
* For webpack 2 the default sort will be 'dependency' instead of 'id'
* Upgrade dependencies
<a name="2.14.0"></a>
## 2.14.0
* Export publicPath to the template
* Add example for inlining css and js
<a name="2.13.0"></a>
## 2.13.0
* Add support for absolute output file names
* Add support for relative file names outside the output path
<a name="2.12.0"></a>
## 2.12.0
* Basic Webpack 2.x support #225
<a name="2.11.0"></a>
## 2.11.0
* 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))
* Add support for webpack placeholders inside the public path e.g. `'/dist/[hash]/'`. ([#249](https://github.com/ampedandwired/html-webpack-plugin/pull/249))
<a name="2.10.0"></a>
## 2.10.0
* Add `hash` field to the chunk object
* Add `compilation` field to the templateParam object ([#237](https://github.com/ampedandwired/html-webpack-plugin/issues/237))
* Add `html-webpack-plugin-before-html-generation` event
* Improve error messages
<a name="2.9.0"></a>
## 2.9.0
* 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))
<a name="2.8.2"></a>
## 2.8.2
* Support relative URLs on Windows ([#205](https://github.com/ampedandwired/html-webpack-plugin/issues/205))
<a name="2.8.1"></a>
## 2.8.1
* Caching improvements ([#204](https://github.com/ampedandwired/html-webpack-plugin/issues/204))
<a name="2.8.0"></a>
## 2.8.0
* Add `dependency` mode for `chunksSortMode` to sort chunks based on their dependencies with each other
<a name="2.7.2"></a>
## 2.7.2
* Add support for require in js templates
<a name="2.7.1"></a>
## 2.7.1
* Refactoring
* Fix relative windows path
<a name="2.6.5"></a>
## 2.6.5
* Minor refactoring
<a name="2.6.4"></a>
## 2.6.4
* Fix for `"Uncaught TypeError: __webpack_require__(...) is not a function"`
* Fix incomplete cache modules causing "HtmlWebpackPlugin Error: No source available"
* Fix some issues on Windows
<a name="2.6.3"></a>
## 2.6.3
* Prevent parsing the base template with the html-loader
<a name="2.6.2"></a>
## 2.6.2
* Fix `lodash` resolve error ([#172](https://github.com/ampedandwired/html-webpack-plugin/issues/172))
<a name="2.6.1"></a>
## 2.6.1
* Fix missing module ([#164](https://github.com/ampedandwired/html-webpack-plugin/issues/164))
<a name="2.6.0"></a>
## 2.6.0
* Move compiler to its own file
* Improve error messages
* Fix global HTML_WEBPACK_PLUGIN variable
<a name="2.5.0"></a>
## 2.5.0
* Support `lodash` template's HTML _"escape"_ delimiter (`<%- %>`)
* Fix bluebird warning ([#130](https://github.com/ampedandwired/html-webpack-plugin/issues/130))
* Fix an issue where incomplete cache modules were used
<a name="2.4.0"></a>
## 2.4.0
* Don't recompile if the assets didn't change
<a name="2.3.0"></a>
## 2.3.0
* 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
<a name="2.2.0"></a>
## 2.2.0
* Inject css and js even if the html file is incomplete ([#135](https://github.com/ampedandwired/html-webpack-plugin/issues/135))
* Update dependencies
<a name="2.1.0"></a>
## 2.1.0
* Synchronize with the stable `@1` version
<a name="2.0.4"></a>
## 2.0.4
* Fix `minify` option
* Fix missing hash interpolation in publicPath
<a name="2.0.3"></a>
## 2.0.3
* Add support for webpack.BannerPlugin
<a name="2.0.2"></a>
## 2.0.2
* Add support for loaders in templates ([#41](https://github.com/ampedandwired/html-webpack-plugin/pull/41))
* Remove `templateContent` option from configuration
* Better error messages
* Update dependencies
<a name="1.7.0"></a>
## 1.7.0
* Add `chunksSortMode` option to configuration to control how chunks should be sorted before they are included to the html
* Don't insert async chunks into html ([#95](https://github.com/ampedandwired/html-webpack-plugin/issues/95))
* Update dependencies
<a name="1.6.2"></a>
## 1.6.2
* Fix paths on Windows
* Fix missing hash interpolation in publicPath
* Allow only `false` or `object` in `minify` configuration option
<a name="1.6.1"></a>
## 1.6.1
* Add `size` field to the chunk object
* Fix stylesheet `<link>`s being discarded when used with `"inject: 'head'"`
* Update dependencies
<a name="1.6.0"></a>
## 1.6.0
* Support placing templates in subfolders
* Don't include chunks with undefined name ([#60](https://github.com/ampedandwired/html-webpack-plugin/pull/60))
* Don't include async chunks
<a name="1.5.2"></a>
## 1.5.2
* Update dependencies (lodash)
<a name="1.5.1"></a>
## 1.5.1
* Fix error when manifest is specified ([#56](https://github.com/ampedandwired/html-webpack-plugin/issues/56))
<a name="1.5.0"></a>
## 1.5.0
* Allow to inject javascript files into the head of the html page
* Fix error reporting
<a name="1.4.0"></a>
## 1.4.0
* Add `favicon.ico` option
* Add html minifcation
<a name="1.2.0"></a>
## 1.2.0
* Set charset using HTML5 meta attribute
* Reload upon change when using webpack watch mode
* Generate manifest attribute when using
[appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)
* Optionally add webpack hash as a query string to resources included in the HTML
(`hash: true`) for cache busting
* CSS files generated using webpack (for example, by using the
[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))
are now automatically included into the generated HTML
* More detailed information about the files generated by webpack is now available
to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more
details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.
* The `templateContent` option can now be a function that returns the template string to use
* Expose webpack configuration to templates (`o.webpackConfig`)
* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).
================================================
FILE: LICENSE
================================================
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
[![npm][npm]][npm-url]
[![node][node]][node-url]

[![tests][tests]][tests-url]
[](#backers)
[](#sponsors)
<div align="center">
<img width="200" height="200" src="https://www.w3.org/html/logo/downloads/HTML5_Badge.svg">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<div>
<img width="100" height="100" title="Webpack Plugin" src="http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg">
</div>
<h1>HTML Webpack Plugin</h1>
<p>Plugin that simplifies creation of HTML files to serve your bundles</p>
</div>
<h2 align="center">Install</h2>
<h3>Webpack 5</h3>
```bash
npm i --save-dev html-webpack-plugin
```
```bash
yarn add --dev html-webpack-plugin
```
<h3>Webpack 4</h3>
```bash
npm i --save-dev html-webpack-plugin@4
```
```bash
yarn add --dev html-webpack-plugin@4
```
This 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
your own template using `lodash` templates or use your own loader.
<h2 align="center">Sponsors</h2>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
Thanks for supporting the ongoing improvements to the html-webpack-plugin!
<h2 align="center">Zero Config</h2>
The `html-webpack-plugin` works without configuration.
It'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).
<h2 align="center">Plugins</h2>
The `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
- [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity) for enhanced asset security
- [appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin) for iOS and Android offline usage
- [favicons-webpack-plugin](https://github.com/jantimon/favicons-webpack-plugin) which generates favicons and icons for iOS, Android and desktop browsers
- [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
- [html-webpack-inline-svg-plugin](https://github.com/thegc/html-webpack-inline-svg-plugin) to inline SVGs in the resulting HTML file.
- [html-webpack-exclude-assets-plugin](https://github.com/jamesjieye/html-webpack-exclude-assets-plugin) for excluding assets using regular expressions
- [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).
- [html-webpack-injector](https://github.com/thearchitgarg/html-webpack-injector) to inject chunks in `head` or `body` (different locations ) of same html document.
- [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'>`
- [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
- [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.
- [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.
- [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.
- [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".
- [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
- [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.
- [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.
- [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
- [html-webpack-inject-preload](https://github.com/principalstudio/html-webpack-inject-preload) allows to add preload links <link rel='preload'> anywhere you want.
- [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.
- [html-webpack-plugin-django](https://github.com/TommasoAmici/html-webpack-plugin-django) a Webpack plugin to inject Django static tags.
- [html-webpack-inject-attributes-plugin](https://github.com/dyw934854565/html-webpack-inject-attributes-plugin) add extra attributes to inject assetTags.
- [js-entry-webpack-plugin](https://github.com/liam61/html-webpack-plugin) creates webpack bundles into your js entry
<h2 align="center">Usage</h2>
The plugin will generate an HTML5 file for you that includes all your `webpack`
bundles in the head using `script` tags. Just add the plugin to your `webpack`
config as follows:
**webpack.config.js**
```js
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "index.js",
output: {
path: __dirname + "/dist",
filename: "index_bundle.js",
},
plugins: [new HtmlWebpackPlugin()],
};
```
This will generate a file `dist/index.html` containing the following
```html
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Webpack App</title>
<script defer src="index_bundle.js"></script>
</head>
<body></body>
</html>
```
If you have multiple `webpack` entry points, they will all be included with `script` tags in the generated HTML.
If 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))
then these will be included with `<link>` tags in the HTML head.
If you have plugins that make use of it, `html-webpack-plugin` should be ordered first before any of the integrated Plugins.
<h2 align="center">Options</h2>
You can pass a hash of configuration options to `html-webpack-plugin`.
Allowed values are as follows:
| Name | Type | Default | Description |
| :----------------------: | :--------------------------------------------------: | :---------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`title`** | `{String}` | `Webpack App` | The title to use for the generated HTML document |
| **`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'`. |
| **`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 |
| **`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 |
| **`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) |
| **`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) |
| **`publicPath`** | `{String\|'auto'}` | `'auto'` | The publicPath used for script and link tags |
| **`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. |
| **`favicon`** | `{String}` | `` | Adds the given favicon path to the output HTML |
| **`meta`** | `{Object}` | `{}` | Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}` |
| **`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` |
| **`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. |
| **`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 |
| **`cache`** | `{Boolean}` | `true` | Emit the file only if it was changed |
| **`showErrors`** | `{Boolean}` | `true` | Errors details will be written into the HTML page |
| **`chunks`** | `{?}` | `?` | Allows you to add only some chunks (e.g only the unit-test chunk) |
| **`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}` |
| **`excludeChunks`** | `{Array.<string>}` | `` | Allows you to skip some chunks (e.g don't add the unit-test chunk) |
| **`xhtml`** | `{Boolean}` | `false` | If `true` render the `link` tags as self-closing (XHTML compliant) |
Here's an example webpack config illustrating how to use these options
**webpack.config.js**
```js
{
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
title: 'My App',
filename: 'assets/admin.html'
})
]
}
```
### Generating Multiple HTML Files
To generate more than one HTML file, declare the plugin more than
once in your plugins array
**webpack.config.js**
```js
{
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin(), // Generates default index.html
new HtmlWebpackPlugin({ // Also generate a test.html
filename: 'test.html',
template: 'src/assets/test.html'
})
]
}
```
### Writing Your Own Templates
If the default generated HTML doesn't meet your needs you can supply
your own template. The easiest way is to use the `template` option and pass a custom HTML file.
The html-webpack-plugin will automatically inject all necessary CSS, JS, manifest
and favicon files into the markup.
Details of other template loaders are [documented here](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md).
```js
plugins: [
new HtmlWebpackPlugin({
title: "Custom template",
// Load a custom template (lodash by default)
template: "index.html",
}),
];
```
**index.html**
```html
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body></body>
</html>
```
If you already have a template loader, you can use it to parse the template.
Please note that this will also happen if you specify the html-loader and use `.html` file as template.
**webpack.config.js**
```js
module: {
loaders: [
{ test: /\.hbs$/, loader: "handlebars-loader" }
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Custom template using Handlebars',
template: 'index.hbs'
})
]
```
You 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.
The following variables are available in the template by default (you can extend them using the `templateParameters` option):
- `htmlWebpackPlugin`: data specific to this plugin
- `htmlWebpackPlugin.options`: the options hash that was passed to
the plugin. In addition to the options actually used by this plugin,
you can use this hash to pass arbitrary data through to your template.
- `htmlWebpackPlugin.tags`: the prepared `headTags` and `bodyTags` Array to render the `<base>`, `<meta>`, `<script>` and `<link>` tags.
Can be used directly in templates and literals. For example:
```html
<html>
<head>
<%= htmlWebpackPlugin.tags.headTags %>
</head>
<body>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</html>
```
- `htmlWebpackPlugin.files`: direct access to the files used during the compilation.
```typescript
publicPath: string;
js: string[];
css: string[];
manifest?: string;
favicon?: string;
```
- `webpackConfig`: the webpack configuration that was used for this compilation. This
can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`).
- `compilation`: the webpack [compilation object](https://webpack.js.org/api/compilation-object/).
This can be used, for example, to get the contents of processed assets and inline them
directly in the page, through `compilation.assets[...].source()`
(see [the inline template example](examples/inline/template.pug)).
The template can also be directly inlined directly into the options object.
⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**
**webpack.config.js**
```js
new HtmlWebpackPlugin({
templateContent: `
<html>
<body>
<h1>Hello World</h1>
</body>
</html>
`,
});
```
The `templateContent` can also access all `templateParameters` values.
⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**
**webpack.config.js**
```js
new HtmlWebpackPlugin({
inject: false,
templateContent: ({ htmlWebpackPlugin }) => `
<html>
<head>
${htmlWebpackPlugin.tags.headTags}
</head>
<body>
<h1>Hello World</h1>
${htmlWebpackPlugin.tags.bodyTags}
</body>
</html>
`,
});
```
### Filtering Chunks
To include only certain chunks you can limit the chunks being used
**webpack.config.js**
```js
plugins: [
new HtmlWebpackPlugin({
chunks: ["app"],
}),
];
```
It is also possible to exclude certain chunks by setting the `excludeChunks` option
**webpack.config.js**
```js
plugins: [
new HtmlWebpackPlugin({
excludeChunks: ["dev-helper"],
}),
];
```
### Minification
If the `minify` option is set to `true` (the default when webpack's `mode` is `'production'`),
the generated HTML will be minified using [html-minifier-terser](https://github.com/DanielRuf/html-minifier-terser)
and the following options:
```js
{
collapseWhitespace: true,
keepClosingSlash: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
}
```
To use custom [html-minifier options](https://github.com/DanielRuf/html-minifier-terser#options-quick-reference)
pass an object to `minify` instead. This object will not be merged with the defaults above.
To disable minification during production mode set the `minify` option to `false`.
### Meta Tags
If the `meta` option is set the html-webpack-plugin will inject meta tags.
For the default template the html-webpack-plugin will already provide a default for the `viewport` meta tag.
Please take a look at this well maintained list of almost all [possible meta tags](https://github.com/joshbuchea/HEAD#meta).
#### name/content meta tags
Most meta tags are configured by setting a `name` and a `content` attribute.
To add those use a key/value pair:
**webpack.config.js**
```js
plugins: [
new HtmlWebpackPlugin({
meta: {
viewport: "width=device-width, initial-scale=1, shrink-to-fit=no",
// Will generate: <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
"theme-color": "#4285f4",
// Will generate: <meta name="theme-color" content="#4285f4">
},
}),
];
```
#### Simulate http response headers
The **http-equiv** attribute is essentially used to simulate a HTTP response header.
This format is supported using an object notation which allows you to add any attribute:
**webpack.config.js**
```js
plugins: [
new HtmlWebpackPlugin({
meta: {
"Content-Security-Policy": {
"http-equiv": "Content-Security-Policy",
content: "default-src https:",
},
// Will generate: <meta http-equiv="Content-Security-Policy" content="default-src https:">
// Which equals to the following http header: `Content-Security-Policy: default-src https:`
"set-cookie": {
"http-equiv": "set-cookie",
content: "name=value; expires=date; path=url",
},
// Will generate: <meta http-equiv="set-cookie" content="value; expires=date; path=url">
// Which equals to the following http header: `set-cookie: value; expires=date; path=url`
},
}),
];
```
### Base Tag
When the `base` option is used,
html-webpack-plugin will inject a [base tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base).
By default, a base tag will not be injected.
The following two are identical and will both insert `<base href="http://example.com/some/page.html">`:
```js
new HtmlWebpackPlugin({
base: "http://example.com/some/page.html",
});
```
```js
new HtmlWebpackPlugin({
base: { href: "http://example.com/some/page.html" },
});
```
The `target` can be specified with the corresponding key:
```js
new HtmlWebpackPlugin({
base: {
href: "http://example.com/some/page.html",
target: "_blank",
},
});
```
which will inject the element `<base href="http://example.com/some/page.html" target="_blank">`.
### Long Term Caching
For long term caching add `contenthash` to the filename.
**Example:**
```js
plugins: [
new HtmlWebpackPlugin({
filename: "index.[contenthash].html",
}),
];
```
`contenthash` is the hash of the content of the output file.
Refer webpack's [Template Strings](https://webpack.js.org/configuration/output/#template-strings) for more details
### Events
To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the HTML this plugin executes
[tapable](https://github.com/webpack/tapable/tree/master) hooks.
The [lib/hooks.js](https://github.com/jantimon/html-webpack-plugin/blob/master/lib/hooks.js) contains all information
about which values are passed.
[](https://github.com/jantimon/html-webpack-plugin/blob/master/flow.puml)
#### `beforeAssetTagGeneration` hook
```
AsyncSeriesWaterfallHook<{
assets: {
publicPath: string,
js: Array<{string}>,
css: Array<{string}>,
favicon?: string | undefined,
manifest?: string | undefined
},
outputName: string,
plugin: HtmlWebpackPlugin
}>
```
#### `alterAssetTags` hook
```
AsyncSeriesWaterfallHook<{
assetTags: {
scripts: Array<HtmlTagObject>,
styles: Array<HtmlTagObject>,
meta: Array<HtmlTagObject>,
},
publicPath: string,
outputName: string,
plugin: HtmlWebpackPlugin
}>
```
#### `alterAssetTagGroups` hook
```
AsyncSeriesWaterfallHook<{
headTags: Array<HtmlTagObject | HtmlTagObject>,
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
publicPath: string,
outputName: string,
plugin: HtmlWebpackPlugin
}>
```
#### `afterTemplateExecution` hook
```
AsyncSeriesWaterfallHook<{
html: string,
headTags: Array<HtmlTagObject | HtmlTagObject>,
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
outputName: string,
plugin: HtmlWebpackPlugin,
}>
```
#### `beforeEmit` hook
```
AsyncSeriesWaterfallHook<{
html: string,
outputName: string,
plugin: HtmlWebpackPlugin,
}>
```
#### `afterEmit` hook
```
AsyncSeriesWaterfallHook<{
outputName: string,
plugin: HtmlWebpackPlugin
}>
```
Example implementation: [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity)
**plugin.js**
```js
// If your plugin is direct dependent to the html webpack plugin:
const HtmlWebpackPlugin = require("html-webpack-plugin");
// If your plugin is using html-webpack-plugin as an optional dependency
// you can use https://github.com/tallesl/node-safe-require instead:
const HtmlWebpackPlugin = require("safe-require")("html-webpack-plugin");
class MyPlugin {
apply(compiler) {
compiler.hooks.compilation.tap("MyPlugin", (compilation) => {
console.log("The compiler is starting a new compilation...");
// Static Plugin interface |compilation |HOOK NAME | register listener
HtmlWebpackPlugin.getCompilationHooks(compilation).beforeEmit.tapAsync(
"MyPlugin", // <-- Set a meaningful name here for stacktraces
(data, cb) => {
// Manipulate the content
data.html += "The Magic Footer";
// Tell webpack to move on
cb(null, data);
},
);
});
}
}
module.exports = MyPlugin;
```
**webpack.config.js**
```js
plugins: [new MyPlugin({ options: "" })];
```
Note that the callback must be passed the HtmlWebpackPluginData in order to pass this onto any other plugins listening on the same `beforeEmit` event
<h2 align="center">Maintainers</h2>
<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/4113649?v=3&s=150">
</br>
<a href="https://github.com/jantimon">Jan Nicklas</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars2.githubusercontent.com/u/4112409?v=3&s=150">
</br>
<a href="https://github.com/mastilver">Thomas Sileghem</a>
</td>
</tr>
<tbody>
</table>
## Backers
Thank you to all our backers!
If 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).
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
## Contributors
This project exists thanks to all the people who contribute.
You'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.
<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>
[npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
[npm-url]: https://npmjs.com/package/html-webpack-plugin
[node]: https://img.shields.io/node/v/html-webpack-plugin.svg
[node-url]: https://nodejs.org
[tests]: https://github.com/jantimon/html-webpack-plugin/workflows/CI/badge.svg
[tests-url]: https://github.com/jantimon/html-webpack-plugin/actions?query=workflow%3ACI
================================================
FILE: commitlint.config.js
================================================
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"header-max-length": [0],
"body-max-line-length": [0],
"footer-max-line-length": [0],
},
};
================================================
FILE: default_index.ejs
================================================
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
</body>
</html>
================================================
FILE: docs/template-option.md
================================================
# The template option
## History
The version 2.x which was introduced 2015 changed the way the template is processed.
Instead of forcing all users to use the [blueimp](https://github.com/blueimp/JavaScript-Templates) template engine it allowed to use any webpack loader:
- [pug](https://github.com/pugjs/pug-loader)
- [ejs](https://github.com/okonet/ejs-loader)
- [underscore](https://github.com/emaphp/underscore-template-loader)
- [handlebars](https://github.com/pcardune/handlebars-loader)
- [html-loader](https://github.com/webpack/html-loader)
- ...
Under the hood it is using a webpack child compilation which inherits all loaders from
your main configuration.
There are three ways to set the loader:
## 1) Don't set any loader
By 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.
Please note that this loader does not support the full ejs syntax as it is based on [lodash template](https://lodash.com/docs/#template).
```js
{
plugins: [
new HtmlWebpackPlugin({
template: "src/index.html",
}),
];
}
```
Be aware, using `.html` as your template extension may unexpectedly trigger another loader.
## 2) Setting a loader directly for the template
```js
new HtmlWebpackPlugin({
// For details on `!!` see https://webpack.js.org/concepts/loaders/#inline
template: "!!handlebars-loader!src/index.hbs",
});
```
## 3) Setting a loader using the `module.rules` syntax
```js
{
module: {
rules: [
{
test: /\.hbs$/,
loader: 'handlebars-loader'
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.hbs'
})
]
}
```
However this also means that in the following example webpack will use the [html loader for your template](https://webpack.js.org/loaders/html-loader/).
This will **cause html minification** and it will also **disable the ejs/lodash fallback** loader.
```js
{
module: {
rules: [
{
test: /\.html$/,
loader: 'html-loader'
}],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
}
```
================================================
FILE: examples/README.md
================================================
# Examples
A collection of repositories or pages using html-webpack-plugin.
| Example | Link |
| --------------------------------- | ----------------------------------------------------- |
| Appcache | [appcache](./appcache) |
| Chunk Optimization | [chunk-optimization](./chunk-optimization) |
| Custom Template | [custom-template](./custom-template) |
| Custom Script / Link tag position | [custom-insertion-point](./custom-insertion-position) |
| Default | [default](./default) |
| Favicon | [favicon](./favicon.) |
| Html Loader | [html-loader](./html-loader) |
| Inline | [inline](./inline) |
| Javascript-advanced | [javascript-advanced](./javascript-advanced) |
| Javascript | [javascript](./javascript) |
| Pug Loader | [pug-loader](./pug-loader) |
| Sort Manually | [sort-manually](./sort-manually) |
| Template Parameters | [template-parameters](./template-parameters) |
================================================
FILE: examples/build-examples.js
================================================
/**
* This file is just a helper to compile all examples.
*
* You could do the same by going into each example and execute
* `webpack`
*/
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
var fs = require("fs");
var path = require("path");
var rimraf = require("rimraf");
var webpack = require("webpack");
var examples = fs.readdirSync(__dirname).filter(function (file) {
return fs.statSync(path.join(__dirname, file)).isDirectory();
});
examples.forEach(function (exampleName) {
var examplePath = path.join(__dirname, exampleName);
var configFile = path.join(examplePath, "webpack.config.js");
var config = require(configFile);
if (Number(webpackMajorVersion) >= 4) {
config.plugins.unshift(
new webpack.LoaderOptionsPlugin({
options: {
context: process.cwd(), // or the same value as `context`
},
}),
);
config.mode = "production";
config.optimization = config.optimization || {};
config.optimization.minimizer = [];
}
rimraf.sync(path.join(examplePath, "dist", "webpack-" + webpackMajorVersion));
webpack(config, function (err, stats) {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
const info = stats.toJson();
if (stats.hasErrors()) {
console.error(info.errors);
}
if (stats.hasWarnings()) {
console.warn(info.warnings);
}
});
});
================================================
FILE: examples/chunk-optimization/dist/webpack-5/192.js
================================================
"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[192],{
/***/ 192
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);
/* 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__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);
var options = {};
options.insert = "head";
options.singleton = false;
var 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);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.locals || {});
/***/ },
/***/ 810
(module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);
/* 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__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
// Module
___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }
}]);
================================================
FILE: examples/chunk-optimization/dist/webpack-5/461.js
================================================
"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[461],{
/***/ 591
(module, __unused_webpack_exports, __webpack_require__) {
var isOldIE = function isOldIE() {
var memo;
return function memorize() {
if (typeof memo === 'undefined') {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
memo = Boolean(window && document && document.all && !window.atob);
}
return memo;
};
}();
var getTarget = function getTarget() {
var memo = {};
return function memorize(target) {
if (typeof memo[target] === 'undefined') {
var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch (e) {
// istanbul ignore next
styleTarget = null;
}
}
memo[target] = styleTarget;
}
return memo[target];
};
}();
var stylesInDom = [];
function getIndexByIdentifier(identifier) {
var result = -1;
for (var i = 0; i < stylesInDom.length; i++) {
if (stylesInDom[i].identifier === identifier) {
result = i;
break;
}
}
return result;
}
function modulesToDom(list, options) {
var idCountMap = {};
var identifiers = [];
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var count = idCountMap[id] || 0;
var identifier = "".concat(id, " ").concat(count);
idCountMap[id] = count + 1;
var index = getIndexByIdentifier(identifier);
var obj = {
css: item[1],
media: item[2],
sourceMap: item[3]
};
if (index !== -1) {
stylesInDom[index].references++;
stylesInDom[index].updater(obj);
} else {
stylesInDom.push({
identifier: identifier,
updater: addStyle(obj, options),
references: 1
});
}
identifiers.push(identifier);
}
return identifiers;
}
function insertStyleElement(options) {
var style = document.createElement('style');
var attributes = options.attributes || {};
if (typeof attributes.nonce === 'undefined') {
var nonce = true ? __webpack_require__.nc : 0;
if (nonce) {
attributes.nonce = nonce;
}
}
Object.keys(attributes).forEach(function (key) {
style.setAttribute(key, attributes[key]);
});
if (typeof options.insert === 'function') {
options.insert(style);
} else {
var target = getTarget(options.insert || 'head');
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
}
target.appendChild(style);
}
return style;
}
function removeStyleElement(style) {
// istanbul ignore if
if (style.parentNode === null) {
return false;
}
style.parentNode.removeChild(style);
}
/* istanbul ignore next */
var replaceText = function replaceText() {
var textStore = [];
return function replace(index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
}();
function applyToSingletonTag(style, index, remove, obj) {
var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) {
style.removeChild(childNodes[index]);
}
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag(style, options, obj) {
var css = obj.css;
var media = obj.media;
var sourceMap = obj.sourceMap;
if (media) {
style.setAttribute('media', media);
} else {
style.removeAttribute('media');
}
if (sourceMap && typeof btoa !== 'undefined') {
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
} // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while (style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
var singleton = null;
var singletonCounter = 0;
function addStyle(obj, options) {
var style;
var update;
var remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = insertStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else {
style = insertStyleElement(options);
update = applyToTag.bind(null, style, options);
remove = function remove() {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle(newObj) {
if (newObj) {
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
module.exports = function (list, options) {
options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton && typeof options.singleton !== 'boolean') {
options.singleton = isOldIE();
}
list = list || [];
var lastIdentifiers = modulesToDom(list, options);
return function update(newList) {
newList = newList || [];
if (Object.prototype.toString.call(newList) !== '[object Array]') {
return;
}
for (var i = 0; i < lastIdentifiers.length; i++) {
var identifier = lastIdentifiers[i];
var index = getIndexByIdentifier(identifier);
stylesInDom[index].references--;
}
var newLastIdentifiers = modulesToDom(newList, options);
for (var _i = 0; _i < lastIdentifiers.length; _i++) {
var _identifier = lastIdentifiers[_i];
var _index = getIndexByIdentifier(_identifier);
if (stylesInDom[_index].references === 0) {
stylesInDom[_index].updater();
stylesInDom.splice(_index, 1);
}
}
lastIdentifiers = newLastIdentifiers;
};
};
/***/ },
/***/ 935
(module) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item);
if (item[2]) {
return "@media ".concat(item[2], " {").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery, dedupe) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = [].concat(modules[_i]);
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue;
}
if (mediaQuery) {
if (!item[2]) {
item[2] = mediaQuery;
} else {
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
}
}
list.push(item);
}
};
return list;
};
/***/ }
}]);
================================================
FILE: examples/chunk-optimization/dist/webpack-5/entryA.html
================================================
<!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>
================================================
FILE: examples/chunk-optimization/dist/webpack-5/entryA.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 910
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
__webpack_require__(192);
var multiply = __webpack_require__(199);
var concat = __webpack_require__(631);
var h1 = document.createElement("h1");
h1.innerHTML = concat("Hello world from Entry ", multiply(1, 1));
document.body.appendChild(h1);
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 570: 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/******/ /* webpack/runtime/nonce */
/******/ (() => {
/******/ __webpack_require__.nc = undefined;
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [646,209,461,192], () => (__webpack_require__(910)))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
================================================
FILE: examples/chunk-optimization/dist/webpack-5/entryB.html
================================================
<!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>
================================================
FILE: examples/chunk-optimization/dist/webpack-5/entryB.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 123
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
__webpack_require__(192);
var multiply = __webpack_require__(199);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world from Entry " + multiply(1, 2);
document.body.appendChild(h1);
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 761: 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/******/ /* webpack/runtime/nonce */
/******/ (() => {
/******/ __webpack_require__.nc = undefined;
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [646,461,192], () => (__webpack_require__(123)))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
================================================
FILE: examples/chunk-optimization/dist/webpack-5/entryC.html
================================================
<!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>
================================================
FILE: examples/chunk-optimization/dist/webpack-5/libMath.js
================================================
(self["webpackChunk"] = self["webpackChunk"] || []).push([[646],{
/***/ 16
(module) {
module.exports = function sum(a, b) {
return a + b;
};
/***/ },
/***/ 199
(module, __unused_webpack_exports, __webpack_require__) {
var sum = __webpack_require__(16);
module.exports = function multiply(a, b) {
var m = 0;
for (var i = 0; i < a; i = sum(i, 1)) {
m = sum(m, b);
}
return m;
};
/***/ }
}]);
================================================
FILE: examples/chunk-optimization/dist/webpack-5/libText.js
================================================
(self["webpackChunk"] = self["webpackChunk"] || []).push([[209],{
/***/ 631
(module) {
module.exports = function concat(a, b) {
return String(a) + String(b);
};
/***/ }
}]);
================================================
FILE: examples/chunk-optimization/entryA.js
================================================
require("./main.css");
var multiply = require("./lib-multiply.js");
var concat = require("./lib-concat.js");
var h1 = document.createElement("h1");
h1.innerHTML = concat("Hello world from Entry ", multiply(1, 1));
document.body.appendChild(h1);
================================================
FILE: examples/chunk-optimization/entryB.js
================================================
require("./main.css");
var multiply = require("./lib-multiply.js");
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world from Entry " + multiply(1, 2);
document.body.appendChild(h1);
================================================
FILE: examples/chunk-optimization/lib-concat.js
================================================
module.exports = function concat(a, b) {
return String(a) + String(b);
};
================================================
FILE: examples/chunk-optimization/lib-multiply.js
================================================
var sum = require("./lib-sum.js");
module.exports = function multiply(a, b) {
var m = 0;
for (var i = 0; i < a; i = sum(i, 1)) {
m = sum(m, b);
}
return m;
};
================================================
FILE: examples/chunk-optimization/lib-sum.js
================================================
module.exports = function sum(a, b) {
return a + b;
};
================================================
FILE: examples/chunk-optimization/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/chunk-optimization/readme.md
================================================
# zero-config example
in this example only the default configuration is used
================================================
FILE: examples/chunk-optimization/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: {
entryA: "./entryA.js",
entryB: "./entryB.js",
},
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "[name].js",
},
module: {
rules: [
{ test: /\.css$/, use: ["style-loader", "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
],
},
optimization: {
splitChunks: {
chunks: "all",
minSize: 0,
maxAsyncRequests: 9,
maxInitialRequests: 9,
name: false,
cacheGroups: {
libMath: {
test: /lib-(multiply|sum)/,
name: "libMath",
chunks: "all",
},
libText: {
test: /lib-concat/,
name: "libText",
chunks: "all",
},
},
},
},
plugins: [
new HtmlWebpackPlugin({
filename: "entryA.html",
chunks: ["entryA"],
}),
new HtmlWebpackPlugin({
filename: "entryB.html",
chunks: ["entryB"],
}),
new HtmlWebpackPlugin({
filename: "entryC.html",
}),
],
};
================================================
FILE: examples/custom-insertion-position/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/custom-insertion-position/dist/webpack-5/index.html
================================================
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="bundle.js"></script>
<title>Custom insertion example</title>
</head>
<body>
All scripts are placed here:
<script>console.log("Executed after all other scripts")</script>
</body>
</html>
================================================
FILE: examples/custom-insertion-position/example.js
================================================
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
================================================
FILE: examples/custom-insertion-position/index.ejs
================================================
<!DOCTYPE html>
<html>
<head>
<%= htmlWebpackPlugin.tags.headTags %>
<title>Custom insertion example</title>
</head>
<body>
All scripts are placed here:
<%= htmlWebpackPlugin.tags.bodyTags %>
<script>console.log("Executed after all other scripts")</script>
</body>
</html>
================================================
FILE: examples/custom-insertion-position/readme.md
================================================
# custom insertion example
This example shows how you can define the position where the scripts are injected
by setting `inject:false` and using the template parameters inside the `index.ejs`
The example is using the template parameters `headTags` and `bodyTags`
```
<%= htmlWebpackPlugin.tags.headTags %>
<%= htmlWebpackPlugin.tags.bodyTags %>
```
`headTags` and `bodyTags` are arrays so you can use any Array.prototype function like `filter`:
```
<%= htmlWebpackPlugin
.tags
.headTags
.filter((tag) => tag.tagName === 'meta')
.join('')
%>
```
For further information about the tag object take a look at the `createHtmlTagObject` inside `lib/html-tags.js` or at the `prepareAssetTagGroupForRendering` inside `index.js`.
================================================
FILE: examples/custom-insertion-position/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
template: "index.ejs",
inject: false,
// The following settings are optional and only used for
// demo purposes:
meta: {
charset: { charset: "utf-8" },
viewport: "width=device-width, initial-scale=1",
},
minify: false,
}),
],
};
================================================
FILE: examples/custom-template/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/custom-template/dist/webpack-5/index.html
================================================
<!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>
================================================
FILE: examples/custom-template/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/custom-template/example.js
================================================
require("./main.css");
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
================================================
FILE: examples/custom-template/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/custom-template/partial.html
================================================
<h2>Partial</h2>
<img src="logo.png" />
================================================
FILE: examples/custom-template/readme.md
================================================
# custom template
This example uses a custom underscore template which inlines an partial using the html-loader:
`<%= require('html-loader!./partial.html').default %>`
================================================
FILE: examples/custom-template/template.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><%= htmlWebpackPlugin.options.title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<%= require('html-loader!./partial.html').default %>
</body>
</html>
================================================
FILE: examples/custom-template/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
],
},
plugins: [
new HtmlWebpackPlugin({
template: "template.html",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/default/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 192
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);
/* 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__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);
var options = {};
options.insert = "head";
options.singleton = false;
var 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);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.locals || {});
/***/ },
/***/ 591
(module, __unused_webpack_exports, __webpack_require__) {
"use strict";
var isOldIE = function isOldIE() {
var memo;
return function memorize() {
if (typeof memo === 'undefined') {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
memo = Boolean(window && document && document.all && !window.atob);
}
return memo;
};
}();
var getTarget = function getTarget() {
var memo = {};
return function memorize(target) {
if (typeof memo[target] === 'undefined') {
var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch (e) {
// istanbul ignore next
styleTarget = null;
}
}
memo[target] = styleTarget;
}
return memo[target];
};
}();
var stylesInDom = [];
function getIndexByIdentifier(identifier) {
var result = -1;
for (var i = 0; i < stylesInDom.length; i++) {
if (stylesInDom[i].identifier === identifier) {
result = i;
break;
}
}
return result;
}
function modulesToDom(list, options) {
var idCountMap = {};
var identifiers = [];
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var count = idCountMap[id] || 0;
var identifier = "".concat(id, " ").concat(count);
idCountMap[id] = count + 1;
var index = getIndexByIdentifier(identifier);
var obj = {
css: item[1],
media: item[2],
sourceMap: item[3]
};
if (index !== -1) {
stylesInDom[index].references++;
stylesInDom[index].updater(obj);
} else {
stylesInDom.push({
identifier: identifier,
updater: addStyle(obj, options),
references: 1
});
}
identifiers.push(identifier);
}
return identifiers;
}
function insertStyleElement(options) {
var style = document.createElement('style');
var attributes = options.attributes || {};
if (typeof attributes.nonce === 'undefined') {
var nonce = true ? __webpack_require__.nc : 0;
if (nonce) {
attributes.nonce = nonce;
}
}
Object.keys(attributes).forEach(function (key) {
style.setAttribute(key, attributes[key]);
});
if (typeof options.insert === 'function') {
options.insert(style);
} else {
var target = getTarget(options.insert || 'head');
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
}
target.appendChild(style);
}
return style;
}
function removeStyleElement(style) {
// istanbul ignore if
if (style.parentNode === null) {
return false;
}
style.parentNode.removeChild(style);
}
/* istanbul ignore next */
var replaceText = function replaceText() {
var textStore = [];
return function replace(index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
}();
function applyToSingletonTag(style, index, remove, obj) {
var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) {
style.removeChild(childNodes[index]);
}
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag(style, options, obj) {
var css = obj.css;
var media = obj.media;
var sourceMap = obj.sourceMap;
if (media) {
style.setAttribute('media', media);
} else {
style.removeAttribute('media');
}
if (sourceMap && typeof btoa !== 'undefined') {
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
} // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while (style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
var singleton = null;
var singletonCounter = 0;
function addStyle(obj, options) {
var style;
var update;
var remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = insertStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else {
style = insertStyleElement(options);
update = applyToTag.bind(null, style, options);
remove = function remove() {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle(newObj) {
if (newObj) {
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
module.exports = function (list, options) {
options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton && typeof options.singleton !== 'boolean') {
options.singleton = isOldIE();
}
list = list || [];
var lastIdentifiers = modulesToDom(list, options);
return function update(newList) {
newList = newList || [];
if (Object.prototype.toString.call(newList) !== '[object Array]') {
return;
}
for (var i = 0; i < lastIdentifiers.length; i++) {
var identifier = lastIdentifiers[i];
var index = getIndexByIdentifier(identifier);
stylesInDom[index].references--;
}
var newLastIdentifiers = modulesToDom(newList, options);
for (var _i = 0; _i < lastIdentifiers.length; _i++) {
var _identifier = lastIdentifiers[_i];
var _index = getIndexByIdentifier(_identifier);
if (stylesInDom[_index].references === 0) {
stylesInDom[_index].updater();
stylesInDom.splice(_index, 1);
}
}
lastIdentifiers = newLastIdentifiers;
};
};
/***/ },
/***/ 810
(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);
/* 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__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
// Module
___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ },
/***/ 935
(module) {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item);
if (item[2]) {
return "@media ".concat(item[2], " {").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery, dedupe) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = [].concat(modules[_i]);
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue;
}
if (mediaQuery) {
if (!item[2]) {
item[2] = mediaQuery;
} else {
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
}
}
list.push(item);
}
};
return list;
};
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/nonce */
/******/ (() => {
/******/ __webpack_require__.nc = undefined;
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(192);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/default/dist/webpack-5/index.html
================================================
<!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>
================================================
FILE: examples/default/example.js
================================================
require("./main.css");
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
================================================
FILE: examples/default/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/default/readme.md
================================================
# zero-config example
in this example only the default configuration is used
================================================
FILE: examples/default/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: ["style-loader", "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
],
},
plugins: [new HtmlWebpackPlugin()],
};
================================================
FILE: examples/favicon/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/favicon/dist/webpack-5/favicon.html
================================================
<!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>
================================================
FILE: examples/favicon/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/favicon/example.js
================================================
require("./main.css");
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
================================================
FILE: examples/favicon/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/favicon/template.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<img src="logo.png" />
</body>
</html>
================================================
FILE: examples/favicon/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
],
},
plugins: [
new HtmlWebpackPlugin({
title: "HtmlWebpackPlugin example",
favicon: "favicon.ico",
filename: "favicon.html",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/html-loader/dist/webpack-5/about.html
================================================
<!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>
================================================
FILE: examples/html-loader/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/html-loader/dist/webpack-5/index.html
================================================
<!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>
================================================
FILE: examples/html-loader/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/html-loader/example.js
================================================
require("./main.css");
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
================================================
FILE: examples/html-loader/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/html-loader/template.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<img src="logo.png" />
</body>
</html>
================================================
FILE: examples/html-loader/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
{ test: /\.html$/, loader: "html-loader" },
],
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
favicon: "favicon.ico",
template: "template.html",
}),
new HtmlWebpackPlugin({
filename: "about.html",
favicon: "favicon.ico",
template: "template.html",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/inline/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
console.log("Hello World");
/******/ })()
;
================================================
FILE: examples/inline/dist/webpack-5/index.html
================================================
<!doctype html><html><head><meta charset="utf-8"><title>pug demo</title></head><body><style>body {
background: snow;
}</style><script>/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
console.log("Hello World");
/******/ })()
;</script></body></html>
================================================
FILE: examples/inline/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/inline/example.js
================================================
"use strict";
require("./main.css");
console.log("Hello World");
================================================
FILE: examples/inline/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/inline/readme.md
================================================
# isomorphic pug example
This example shows how to use a different template engine (in this case pug)
to load the `time.pug` template on the backend and frontend.
================================================
FILE: examples/inline/template.pug
================================================
doctype html
html
head
meta(charset="utf-8")
title #{htmlWebpackPlugin.options.title}
body
each cssFile in htmlWebpackPlugin.files.css
style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
each jsFile in htmlWebpackPlugin.files.js
script !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
================================================
FILE: examples/inline/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.pug$/, loader: "pug-loader" },
],
},
plugins: [
new HtmlWebpackPlugin({
inject: false,
cache: false,
template: "template.pug",
filename: "index.html",
favicon: "favicon.ico",
title: "pug demo",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/javascript/dist/webpack-5/bundle.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 48
(module) {
"use strict";
// This file is used for frontend and backend
// If compiled by the html-webpack-plugin
// HTML_WEBPACK_PLUGIN is set to true:
var backend = typeof HTML_WEBPACK_PLUGIN !== "undefined";
module.exports = function () {
return "Hello World from " + (backend ? "backend" : "frontend");
};
/***/ },
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__(969);
var universal = __webpack_require__(48);
var h1 = document.createElement("h1");
h1.innerHTML = universal();
document.body.appendChild(h1);
/******/ })()
;
================================================
FILE: examples/javascript/dist/webpack-5/index.html
================================================
<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"/>
================================================
FILE: examples/javascript/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/javascript/example.js
================================================
require("./main.css");
var universal = require("./universal.js");
var h1 = document.createElement("h1");
h1.innerHTML = universal();
document.body.appendChild(h1);
================================================
FILE: examples/javascript/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/javascript/partial.html
================================================
<h2>Partial</h2>
<img src="logo.png" />
================================================
FILE: examples/javascript/readme.md
================================================
# isomorphic javascript example
This example shows how to generate a template on the fly using javascript.
The best way to debug the compilation result is `devTool:eval`
================================================
FILE: examples/javascript/template.js
================================================
// Webpack require:
var partial = require("./partial.html").default;
var universal = require("./universal.js");
// Export a function / promise / or a string:
module.exports = universal() + new Date().toISOString() + partial;
================================================
FILE: examples/javascript/universal.js
================================================
// This file is used for frontend and backend
"use strict";
// If compiled by the html-webpack-plugin
// HTML_WEBPACK_PLUGIN is set to true:
var backend = typeof HTML_WEBPACK_PLUGIN !== "undefined";
module.exports = function () {
return "Hello World from " + (backend ? "backend" : "frontend");
};
================================================
FILE: examples/javascript/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
{ test: /\.html$/, loader: "html-loader" },
],
},
plugins: [
new HtmlWebpackPlugin({
template: "template.js",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/javascript-advanced/dist/webpack-5/bundle.js
================================================
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 48
(module) {
"use strict";
eval("{// 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}");
/***/ },
/***/ 695
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
eval("{__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}");
/***/ },
/***/ 969
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack:///./main.css?\n}");
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__(695);
/******/
/******/ })()
;
================================================
FILE: examples/javascript-advanced/dist/webpack-5/index.html
================================================
<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>
================================================
FILE: examples/javascript-advanced/dist/webpack-5/styles.css
================================================
body {
background: snow;
}
================================================
FILE: examples/javascript-advanced/example.js
================================================
require("./main.css");
var universal = require("./universal.js");
var h1 = document.createElement("h1");
h1.innerHTML = universal();
document.body.appendChild(h1);
================================================
FILE: examples/javascript-advanced/main.css
================================================
body {
background: snow;
}
================================================
FILE: examples/javascript-advanced/partial.html
================================================
<h2>Partial</h2>
<img src="logo.png" />
================================================
FILE: examples/javascript-advanced/readme.md
================================================
# isomorphic javascript-advanced example
This example is similar to the javascript example however it allows takes
parameters from the config and works asynchronously
================================================
FILE: examples/javascript-advanced/template.js
================================================
// Webpack require:
var partial = require("./partial.html").default;
var universal = require("./universal.js");
// Export a function / promise / or a string:
// This function has to return a string or promised string:
module.exports = function (templateParams) {
var html =
"<html><head>" +
"<title>" +
templateParams.htmlWebpackPlugin.options.title +
"</title>" +
"</head><body>" +
universal() +
" - " +
partial +
"</body></html>";
return html;
};
================================================
FILE: examples/javascript-advanced/universal.js
================================================
// This file is used for frontend and backend
"use strict";
// If compiled by the html-webpack-plugin
// HTML_WEBPACK_PLUGIN is set to true:
var backend = typeof HTML_WEBPACK_PLUGIN !== "undefined";
module.exports = function () {
return "Hello World from " + (backend ? "backend" : "frontend");
};
================================================
FILE: examples/javascript-advanced/webpack.config.js
================================================
var path = require("path");
var HtmlWebpackPlugin = require("../..");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var webpackMajorVersion = require("webpack/package.json").version.split(".")[0];
module.exports = {
context: __dirname,
entry: "./example.js",
output: {
path: path.join(__dirname, "dist/webpack-" + webpackMajorVersion),
publicPath: "",
filename: "bundle.js",
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
{ test: /\.png$/, type: "asset/resource" },
{ test: /\.html$/, loader: "html-loader" },
],
},
devtool: "eval",
plugins: [
new HtmlWebpackPlugin({
template: "template.js",
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
],
};
================================================
FILE: examples/multi-page/dist/webpack-5/first.html
================================================
<!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>
================================================
FILE: examples/multi-page/dist/webpack-5/first.js
================================================
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 192
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);
/* 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__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);
var options = {};
options.insert = "head";
options.singleton = false;
var 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);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.locals || {});
/***/ },
/***/ 591
(module, __unused_webpack_exports, __webpack_require__) {
"use strict";
var isOldIE = function isOldIE() {
var memo;
return function memorize() {
if (typeof memo === 'undefined') {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
memo = Boolean(window && document && document.all && !window.atob);
}
return memo;
};
}();
var getTarget = function getTarget() {
var memo = {};
return function memorize(target) {
if (typeof memo[target] === 'undefined') {
var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch (e) {
// istanbul ignore next
styleTarget = null;
}
}
memo[target] = styleTarget;
}
return memo[target];
};
}();
var stylesInDom = [];
function getIndexByIdentifier(identifier) {
var result = -1;
for (var i = 0; i < stylesInDom.length; i++) {
if (stylesInDom[i].identifier === identifier) {
result = i;
break;
}
}
return result;
}
function modulesToDom(list, options) {
var idCountMap = {};
var identifiers = [];
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var count = idCountMap[id] || 0;
var identifier = "".concat(id, " ").concat(count);
idCountMap[id] = count + 1;
var index = getIndexByIdentifier(identifier);
var obj = {
css: item[1],
media: item[2],
sourceMap: item[3]
};
if (index !== -1) {
stylesInDom[index].references++;
stylesInDom[index].updater(obj);
} else {
stylesInDom.push({
identifier: identifier,
updater: addStyle(obj, options),
references: 1
});
}
identifiers.push(identifier);
}
return identifiers;
}
function insertStyleElement(options) {
var style = document.createElement('style');
var attributes = options.attributes || {};
if (typeof attributes.nonce === 'undefined') {
var nonce = true ? __webpack_require__.nc : 0;
if (nonce) {
attributes.nonce = nonce;
}
}
Object.keys(attributes).forEach(function (key) {
style.setAttribute(key, attributes[key]);
});
if (typeof options.insert === 'function') {
options.insert(style);
} else {
var target = getTarget(options.insert || 'head');
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
}
target.appendChild(style);
}
return style;
}
function removeStyleElement(style) {
// istanbul ignore if
if (style.parentNode === null) {
return false;
}
style.parentNode.removeChild(style);
}
/* istanbul ignore next */
var replaceText = function replaceText() {
var textStore = [];
return function replace(index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
}();
function applyToSingletonTag(style, index, remove, obj) {
var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) {
style.removeChild(childNodes[index]);
}
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag(style, options, obj) {
var css = obj.css;
var media = obj.media;
var sourceMap = obj.sourceMap;
if (media) {
style.setAttribute('media', media);
} else {
style.removeAttribute('media');
}
if (sourceMap && typeof btoa !== 'undefined') {
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
} // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while (style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
var singleton = null;
var singletonCounter = 0;
function addStyle(obj, options) {
var style;
var update;
var remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = insertStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else {
style = insertStyleElement(options);
update = applyToTag.bind(null, style, options);
remove = function remove() {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle(newObj) {
if (newObj) {
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
module.exports = function (list, options) {
options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton && typeof options.singleton !== 'boolean') {
options.singleton = isOldIE();
}
list = list || [];
var lastIdentifiers = modulesToDom(list, options);
return function update(newList) {
newList = newList || [];
if (Object.prototype.toString.call(newList) !== '[object Array]') {
return;
}
for (var i = 0; i < lastIdentifiers.length; i++) {
var identifier = lastIdentifiers[i];
var index = getIndexByIdentifier(identifier);
stylesInDom[index].references--;
}
var newLastIdentifiers = modulesToDom(newList, options);
for (var _i = 0; _i < lastIdentifiers.length; _i++) {
var _identifier = lastIdentifiers[_i];
var _index = getIndexByIdentifier(_identifier);
if (stylesInDom[_index].references === 0) {
stylesInDom[_index].updater();
stylesInDom.splice(_index, 1);
}
}
lastIdentifiers = newLastIdentifiers;
};
};
/***/ },
/***/ 810
(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);
/* 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__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
// Module
___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ },
/***/ 935
(module) {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item);
if (item[2]) {
return "@media ".concat(item[2], " {").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery, dedupe) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = [].concat(modules[_i]);
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue;
}
if (mediaQuery) {
if (!item[2]) {
item[2] = mediaQuery;
} else {
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
}
}
list.push(item);
}
};
return list;
};
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, ke
gitextract_5kqxl4xw/ ├── .cspell.json ├── .editorconfig ├── .eslintrc.js ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── issue_template.md │ ├── lock.yml │ ├── stale.yml │ └── workflows/ │ └── main.yml ├── .gitignore ├── .husky/ │ ├── commit-msg │ └── pre-commit ├── .mailmap ├── .node-version ├── .prettierignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── commitlint.config.js ├── default_index.ejs ├── docs/ │ └── template-option.md ├── examples/ │ ├── README.md │ ├── build-examples.js │ ├── chunk-optimization/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── 192.js │ │ │ ├── 461.js │ │ │ ├── entryA.html │ │ │ ├── entryA.js │ │ │ ├── entryB.html │ │ │ ├── entryB.js │ │ │ ├── entryC.html │ │ │ ├── libMath.js │ │ │ └── libText.js │ │ ├── entryA.js │ │ ├── entryB.js │ │ ├── lib-concat.js │ │ ├── lib-multiply.js │ │ ├── lib-sum.js │ │ ├── main.css │ │ ├── readme.md │ │ └── webpack.config.js │ ├── custom-insertion-position/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ └── index.html │ │ ├── example.js │ │ ├── index.ejs │ │ ├── readme.md │ │ └── webpack.config.js │ ├── custom-template/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── partial.html │ │ ├── readme.md │ │ ├── template.html │ │ └── webpack.config.js │ ├── default/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ └── index.html │ │ ├── example.js │ │ ├── main.css │ │ ├── readme.md │ │ └── webpack.config.js │ ├── favicon/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── favicon.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── template.html │ │ └── webpack.config.js │ ├── html-loader/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── about.html │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── template.html │ │ └── webpack.config.js │ ├── inline/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── readme.md │ │ ├── template.pug │ │ └── webpack.config.js │ ├── javascript/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── partial.html │ │ ├── readme.md │ │ ├── template.js │ │ ├── universal.js │ │ └── webpack.config.js │ ├── javascript-advanced/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── partial.html │ │ ├── readme.md │ │ ├── template.js │ │ ├── universal.js │ │ └── webpack.config.js │ ├── multi-page/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── first.html │ │ │ ├── first.js │ │ │ ├── second.html │ │ │ └── second.js │ │ ├── first.js │ │ ├── main.css │ │ ├── readme.md │ │ ├── second.js │ │ └── webpack.config.js │ ├── pug-loader/ │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── example.js │ │ ├── main.css │ │ ├── readme.md │ │ ├── template.pug │ │ ├── time.pug │ │ └── webpack.config.js │ ├── sort-manually/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── dist/ │ │ │ └── webpack-5/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ ├── first-file.html │ │ │ ├── second-file.html │ │ │ └── styles.css │ │ ├── e.js │ │ ├── main.css │ │ ├── template.html │ │ └── webpack.config.js │ └── template-parameters/ │ ├── dist/ │ │ └── webpack-5/ │ │ ├── bundle.js │ │ └── index.html │ ├── example.js │ ├── index.ejs │ ├── readme.md │ └── webpack.config.js ├── flow.puml ├── index.js ├── lib/ │ ├── cached-child-compiler.js │ ├── child-compiler.js │ ├── chunksorter.js │ ├── errors.js │ ├── hooks.js │ ├── html-tags.js │ └── loader.js ├── lint-staged.config.js ├── logs ├── migration.md ├── package.json ├── spec/ │ ├── basic.spec.js │ ├── caching.spec.js │ ├── example.spec.js │ ├── fixtures/ │ │ ├── async.js │ │ ├── common.js │ │ ├── empty.html │ │ ├── empty_html.html │ │ ├── html-template-with-image.html │ │ ├── index.js │ │ ├── interpolation.html │ │ ├── invalid.html │ │ ├── logo.html │ │ ├── main.css │ │ ├── plain.html │ │ ├── spaced_plain.html │ │ ├── src/ │ │ │ └── index.ejs │ │ ├── template-partial.hbs │ │ ├── template.ejs │ │ ├── template.hbs │ │ ├── template.pug │ │ ├── templateParam.cjs │ │ ├── templateParam.js │ │ ├── test.html │ │ ├── theme.js │ │ ├── util.js │ │ └── webpackconfig.html │ └── hot.spec.js ├── tsconfig.json └── typings.d.ts
SYMBOL INDEX (124 symbols across 27 files)
FILE: examples/chunk-optimization/dist/webpack-5/192.js
method 192 (line 4) | 192
method 810 (line 30) | 810
FILE: examples/chunk-optimization/dist/webpack-5/461.js
method 591 (line 4) | 591
method 935 (line 279) | 935
FILE: examples/chunk-optimization/dist/webpack-5/entryA.js
method 910 (line 4) | 910
function __webpack_require__ (line 23) | function __webpack_require__(moduleId) {
FILE: examples/chunk-optimization/dist/webpack-5/entryB.js
method 123 (line 4) | 123
function __webpack_require__ (line 22) | function __webpack_require__(moduleId) {
FILE: examples/chunk-optimization/dist/webpack-5/libMath.js
method 16 (line 3) | 16
method 199 (line 13) | 199
FILE: examples/chunk-optimization/dist/webpack-5/libText.js
method 631 (line 3) | 631
FILE: examples/custom-template/dist/webpack-5/bundle.js
method 969 (line 4) | 969
function __webpack_require__ (line 20) | function __webpack_require__(moduleId) {
FILE: examples/default/dist/webpack-5/bundle.js
method 192 (line 4) | 192
method 591 (line 31) | 591
method 810 (line 307) | 810
method 935 (line 327) | 935
function __webpack_require__ (line 406) | function __webpack_require__(moduleId) {
FILE: examples/favicon/dist/webpack-5/bundle.js
method 969 (line 4) | 969
function __webpack_require__ (line 20) | function __webpack_require__(moduleId) {
FILE: examples/html-loader/dist/webpack-5/bundle.js
method 969 (line 4) | 969
function __webpack_require__ (line 20) | function __webpack_require__(moduleId) {
FILE: examples/inline/dist/webpack-5/bundle.js
method 969 (line 5) | 969
function __webpack_require__ (line 20) | function __webpack_require__(moduleId) {
FILE: examples/javascript-advanced/dist/webpack-5/bundle.js
method 48 (line 12) | 48
method 695 (line 20) | 695
method 969 (line 27) | 969
function __webpack_require__ (line 41) | function __webpack_require__(moduleId) {
FILE: examples/javascript/dist/webpack-5/bundle.js
method 48 (line 4) | 48
method 969 (line 22) | 969
function __webpack_require__ (line 38) | function __webpack_require__(moduleId) {
FILE: examples/multi-page/dist/webpack-5/first.js
method 192 (line 4) | 192
method 591 (line 31) | 591
method 810 (line 307) | 810
method 935 (line 327) | 935
function __webpack_require__ (line 406) | function __webpack_require__(moduleId) {
FILE: examples/multi-page/dist/webpack-5/second.js
method 192 (line 4) | 192
method 591 (line 31) | 591
method 810 (line 307) | 810
method 935 (line 327) | 935
function __webpack_require__ (line 406) | function __webpack_require__(moduleId) {
FILE: examples/pug-loader/dist/webpack-5/bundle.js
method 355 (line 4) | 355
method 487 (line 298) | 487
method 900 (line 316) | 900
method 969 (line 323) | 969
function __webpack_require__ (line 339) | function __webpack_require__(moduleId) {
FILE: examples/sort-manually/dist/webpack-5/a.js
method 969 (line 4) | 969
function __webpack_require__ (line 20) | function __webpack_require__(moduleId) {
FILE: index.js
class HtmlWebpackPlugin (line 38) | class HtmlWebpackPlugin {
method getCompilationHooks (line 100) | static getCompilationHooks(compilation) {
method constructor (line 121) | constructor(options) {
method apply (line 164) | apply(compiler) {
method getTemplatePath (line 320) | getTemplatePath(template, context) {
method filterEntryChunks (line 352) | filterEntryChunks(chunks, includedChunks, excludedChunks) {
method sortEntryChunks (line 383) | sortEntryChunks(entryNames, sortMode, compilation) {
method urlencodePath (line 417) | urlencodePath(filePath) {
method appendHash (line 440) | appendHash(url, hash) {
method getPublicPath (line 458) | getPublicPath(compilation, filename, customPublicPath) {
method getAssetsInformationByGroups (line 508) | getAssetsInformationByGroups(compilation, outputName, entryNames) {
method evaluateCompilationResult (line 619) | evaluateCompilationResult(source, publicPath, templateFilename) {
method prepareAssetTagGroupForRendering (line 692) | prepareAssetTagGroupForRendering(assetTagGroup) {
method getTemplateParameters (line 717) | getTemplateParameters(compilation, assetsInformationByGroups, assetTag...
method executeTemplate (line 776) | executeTemplate(
method postProcessHtml (line 812) | postProcessHtml(
method getAssetFiles (line 952) | getAssetFiles(assets) {
method generateFavicon (line 973) | generateFavicon(
method generatedScriptTags (line 1023) | generatedScriptTags(jsAssets) {
method generateStyleTags (line 1054) | generateStyleTags(cssAssets) {
method generateBaseTag (line 1072) | generateBaseTag(base) {
method generatedMetaTags (line 1096) | generatedMetaTags(metaOptions) {
method generateFaviconTag (line 1138) | generateFaviconTag(favicon) {
method groupAssetsByElements (line 1166) | groupAssetsByElements(assetTags, scriptTarget) {
method replacePlaceholdersInFilename (line 1203) | replacePlaceholdersInFilename(compiler, filename, fileContent, compila...
method generateHTML (line 1246) | generateHTML(
function templateParametersGenerator (line 1534) | function templateParametersGenerator(compilation, assets, assetTags, opt...
FILE: lib/cached-child-compiler.js
class CachedChildCompilation (line 50) | class CachedChildCompilation {
method constructor (line 54) | constructor(compiler) {
method addEntry (line 75) | addEntry(entry) {
method getCompilationResult (line 87) | getCompilationResult() {
method getCompilationEntryResult (line 107) | getCompilationEntryResult(entry) {
class PersistentChildCompilerSingletonPlugin (line 122) | class PersistentChildCompilerSingletonPlugin {
method createSnapshot (line 129) | static createSnapshot(fileDependencies, mainCompilation, startTime) {
method isSnapshotValid (line 156) | static isSnapshotValid(snapshot, mainCompilation) {
method watchFiles (line 170) | static watchFiles(mainCompilation, fileDependencies) {
method constructor (line 178) | constructor() {
method apply (line 224) | apply(compiler) {
method addEntry (line 365) | addEntry(entry) {
method getLatestResult (line 381) | getLatestResult() {
method isCacheValid (line 405) | isCacheValid(snapshot, mainCompilation) {
method compileEntries (line 442) | compileEntries(mainCompilation, entries) {
method watchFiles (line 475) | watchFiles(mainCompilation, files) {
FILE: lib/child-compiler.js
class HtmlWebpackChildCompiler (line 20) | class HtmlWebpackChildCompiler {
method constructor (line 25) | constructor(templates) {
method isCompiling (line 53) | isCompiling() {
method didCompile (line 62) | didCompile() {
method compileTemplates (line 73) | compileTemplates(mainCompilation) {
FILE: lib/errors.js
function getPrettyError (line 6) | function getPrettyError() {
FILE: lib/html-tags.js
function htmlTagObjectToString (line 46) | function htmlTagObjectToString(tagDefinition, xhtml) {
function createHtmlTagObject (line 90) | function createHtmlTagObject(tagName, attributes, innerHTML, meta) {
class HtmlTagArray (line 117) | class HtmlTagArray extends Array {
method toString (line 118) | toString() {
FILE: spec/basic.spec.js
constant OUTPUT_DIR (line 26) | const OUTPUT_DIR = path.resolve(__dirname, "../dist/basic-spec");
function testHtmlPlugin (line 31) | function testHtmlPlugin(
function getChunksInfoFromStats (line 96) | function getChunksInfoFromStats(stats) {
method publicPath (line 1055) | publicPath() {
FILE: spec/caching.spec.js
constant OUTPUT_DIR (line 14) | const OUTPUT_DIR = path.join(__dirname, "../dist/caching-spec");
function setUpCompiler (line 19) | function setUpCompiler(htmlWebpackPlugin) {
function getCompiledModules (line 47) | function getCompiledModules(statsJson) {
function getCompiledModuleCount (line 60) | function getCompiledModuleCount(statsJson) {
function expectNoErrors (line 64) | function expectNoErrors(stats) {
FILE: spec/example.spec.js
constant OUTPUT_DIR (line 17) | const OUTPUT_DIR = path.resolve(__dirname, "../dist");
function runExample (line 21) | function runExample(exampleName, done) {
FILE: spec/hot.spec.js
constant OUTPUT_DIR (line 15) | const OUTPUT_DIR = path.join(__dirname, "../dist/caching-spec");
constant DEFAULT_LOADER (line 19) | const DEFAULT_LOADER = require.resolve("../lib/loader.js") + "?force";
constant DEFAULT_TEMPLATE (line 20) | const DEFAULT_TEMPLATE =
class MyPlugin (line 208) | class MyPlugin {
method apply (line 209) | apply(compiler) {
FILE: typings.d.ts
class HtmlWebpackPlugin (line 7) | class HtmlWebpackPlugin {
type MinifyOptions (line 38) | type MinifyOptions = HtmlMinifierOptions;
type Options (line 40) | interface Options {
type ProcessedOptions (line 180) | interface ProcessedOptions extends Required<Options> {
type TemplateParameter (line 189) | interface TemplateParameter {
type Hooks (line 208) | interface Hooks {
type HtmlTagObject (line 263) | interface HtmlTagObject {
Condensed preview — 187 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (485K chars).
[
{
"path": ".cspell.json",
"chars": 732,
"preview": "{\n \"version\": \"0.2\",\n \"language\": \"en,en-gb\",\n \"words\": [\n \"commitlint\",\n \"chunkhash\",\n \"concat\",\n \"syste"
},
{
"path": ".editorconfig",
"chars": 188,
"preview": "root = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\nend_of_line = lf\ninsert_final_newline = true\ntrim_"
},
{
"path": ".eslintrc.js",
"chars": 561,
"preview": "module.exports = {\n env: {\n node: true,\n commonjs: true,\n es2021: true,\n },\n extends: \"eslint:recommended\",\n"
},
{
"path": ".github/FUNDING.yml",
"chars": 682,
"preview": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [u"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 1227,
"preview": "---\nname: Bug report\nabout: Create a 🕷 report to help us improve\n---\n\n<!-- If you deleting this template this issue is v"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 559,
"preview": "---\nname: Feature request\nabout: Suggest an idea for this project\n---\n\n**Is your feature request related to a problem? P"
},
{
"path": ".github/issue_template.md",
"chars": 2007,
"preview": "<!-- CLICK \"Preview\" FOR INSTRUCTIONS IN A MORE READABLE FORMAT -->\n\n## Prerequisites\n\n- We realize there is a lot of da"
},
{
"path": ".github/lock.yml",
"chars": 454,
"preview": "# Configuration for lock-threads - https://github.com/dessant/lock-threads\n\n# Issues and pull requests with these labels"
},
{
"path": ".github/stale.yml",
"chars": 655,
"preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 180\n# Number of days of inactivity before a"
},
{
"path": ".github/workflows/main.yml",
"chars": 2536,
"preview": "name: CI\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\njobs:\n lint:\n name: Lint "
},
{
"path": ".gitignore",
"chars": 109,
"preview": "/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",
"chars": 38,
"preview": "npx --no-install commitlint --edit $1\n"
},
{
"path": ".husky/pre-commit",
"chars": 29,
"preview": "npx --no-install lint-staged\n"
},
{
"path": ".mailmap",
"chars": 351,
"preview": "Chris Greening <chris@cmgresearch.com>\nJan Nicklas <j.nicklas@me.com>\nJan Nicklas <j.nicklas@me.com> <j.nicklas@sinnersc"
},
{
"path": ".node-version",
"chars": 8,
"preview": "10.13.0\n"
},
{
"path": ".prettierignore",
"chars": 74,
"preview": "/coverage\n/dist\n/node_modules\n/spec/fixtures\nCHANGELOG.md\nexamples/*/dist\n"
},
{
"path": "CHANGELOG.md",
"chars": 41755,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github."
},
{
"path": "LICENSE",
"chars": 1071,
"preview": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na "
},
{
"path": "README.md",
"chars": 39888,
"preview": "[![npm][npm]][npm-url]\n[![node][node]][node-url]\n\n[![tests]"
},
{
"path": "commitlint.config.js",
"chars": 184,
"preview": "module.exports = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"header-max-length\": [0],\n \"body-ma"
},
{
"path": "default_index.ejs",
"chars": 153,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title><%= htmlWebpackPlugin.options.title %></title>\n <"
},
{
"path": "docs/template-option.md",
"chars": 2179,
"preview": "# The template option\n\n## History\n\nThe version 2.x which was introduced 2015 changed the way the template is processed.\n"
},
{
"path": "examples/README.md",
"chars": 1488,
"preview": "# Examples\n\nA collection of repositories or pages using html-webpack-plugin.\n\n| Example | Link"
},
{
"path": "examples/build-examples.js",
"chars": 1485,
"preview": "/**\n * This file is just a helper to compile all examples.\n *\n * You could do the same by going into each example and ex"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/192.js",
"chars": 2338,
"preview": "\"use strict\";\n(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[192],{\n\n/***/ 192\n(__unused_webpack_module, __w"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/461.js",
"chars": 8572,
"preview": "\"use strict\";\n(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[461],{\n\n/***/ 591\n(module, __unused_webpack_exp"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/entryA.html",
"chars": 400,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/entryA.js",
"chars": 7252,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 910\n(__unused_webpack_module, __unus"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/entryB.html",
"chars": 352,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/entryB.js",
"chars": 7202,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 123\n(__unused_webpack_module, __unus"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/entryC.html",
"chars": 447,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/libMath.js",
"chars": 412,
"preview": "(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[646],{\n\n/***/ 16\n(module) {\n\nmodule.exports = function sum(a,"
},
{
"path": "examples/chunk-optimization/dist/webpack-5/libText.js",
"chars": 180,
"preview": "(self[\"webpackChunk\"] = self[\"webpackChunk\"] || []).push([[209],{\n\n/***/ 631\n(module) {\n\nmodule.exports = function conca"
},
{
"path": "examples/chunk-optimization/entryA.js",
"chars": 245,
"preview": "require(\"./main.css\");\nvar multiply = require(\"./lib-multiply.js\");\nvar concat = require(\"./lib-concat.js\");\nvar h1 = do"
},
{
"path": "examples/chunk-optimization/entryB.js",
"chars": 197,
"preview": "require(\"./main.css\");\nvar multiply = require(\"./lib-multiply.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML "
},
{
"path": "examples/chunk-optimization/lib-concat.js",
"chars": 76,
"preview": "module.exports = function concat(a, b) {\n return String(a) + String(b);\n};\n"
},
{
"path": "examples/chunk-optimization/lib-multiply.js",
"chars": 171,
"preview": "var sum = require(\"./lib-sum.js\");\nmodule.exports = function multiply(a, b) {\n var m = 0;\n for (var i = 0; i < a; i = "
},
{
"path": "examples/chunk-optimization/lib-sum.js",
"chars": 57,
"preview": "module.exports = function sum(a, b) {\n return a + b;\n};\n"
},
{
"path": "examples/chunk-optimization/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/chunk-optimization/readme.md",
"chars": 78,
"preview": "# zero-config example\n\nin this example only the default configuration is used\n"
},
{
"path": "examples/chunk-optimization/webpack.config.js",
"chars": 1247,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package"
},
{
"path": "examples/custom-insertion-position/dist/webpack-5/bundle.js",
"chars": 155,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.bod"
},
{
"path": "examples/custom-insertion-position/dist/webpack-5/index.html",
"chars": 354,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-sca"
},
{
"path": "examples/custom-insertion-position/example.js",
"chars": 101,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/custom-insertion-position/index.ejs",
"chars": 301,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <%= htmlWebpackPlugin.tags.headTags %>\n <title>Custom insertion example</title>\n "
},
{
"path": "examples/custom-insertion-position/readme.md",
"chars": 735,
"preview": "# custom insertion example\n\nThis example shows how you can define the position where the scripts are injected\nby setting"
},
{
"path": "examples/custom-insertion-position/webpack.config.js",
"chars": 686,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package"
},
{
"path": "examples/custom-template/dist/webpack-5/bundle.js",
"chars": 2002,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webp"
},
{
"path": "examples/custom-template/dist/webpack-5/index.html",
"chars": 322,
"preview": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Webpack App</title><meta name=\"viewport\" content=\"wid"
},
{
"path": "examples/custom-template/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/custom-template/example.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/custom-template/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/custom-template/partial.html",
"chars": 40,
"preview": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
},
{
"path": "examples/custom-template/readme.md",
"chars": 169,
"preview": "# custom template\n\nThis example uses a custom underscore template which inlines an partial using the html-loader:\n`<%= r"
},
{
"path": "examples/custom-template/template.html",
"chars": 298,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title><%= htmlWebpackPlugin.options.title %>"
},
{
"path": "examples/custom-template/webpack.config.js",
"chars": 727,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/default/dist/webpack-5/bundle.js",
"chars": 13893,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webp"
},
{
"path": "examples/default/dist/webpack-5/index.html",
"chars": 216,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/default/example.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/default/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/default/readme.md",
"chars": 78,
"preview": "# zero-config example\n\nin this example only the default configuration is used\n"
},
{
"path": "examples/default/webpack.config.js",
"chars": 544,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package"
},
{
"path": "examples/favicon/dist/webpack-5/bundle.js",
"chars": 2002,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webp"
},
{
"path": "examples/favicon/dist/webpack-5/favicon.html",
"chars": 307,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>HtmlWebpackPlugin example</title><meta name=\"viewport\" content=\""
},
{
"path": "examples/favicon/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/favicon/example.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/favicon/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/favicon/template.html",
"chars": 246,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Example template</title>\n <meta nam"
},
{
"path": "examples/favicon/webpack.config.js",
"chars": 798,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/html-loader/dist/webpack-5/about.html",
"chars": 347,
"preview": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content"
},
{
"path": "examples/html-loader/dist/webpack-5/bundle.js",
"chars": 2002,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webp"
},
{
"path": "examples/html-loader/dist/webpack-5/index.html",
"chars": 347,
"preview": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content"
},
{
"path": "examples/html-loader/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/html-loader/example.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/html-loader/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/html-loader/template.html",
"chars": 246,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Example template</title>\n <meta nam"
},
{
"path": "examples/html-loader/webpack.config.js",
"chars": 966,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/inline/dist/webpack-5/bundle.js",
"chars": 1941,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unuse"
},
{
"path": "examples/inline/dist/webpack-5/index.html",
"chars": 2100,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>pug demo</title></head><body><style>body {\n background: snow;\n}"
},
{
"path": "examples/inline/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/inline/example.js",
"chars": 66,
"preview": "\"use strict\";\nrequire(\"./main.css\");\n\nconsole.log(\"Hello World\");\n"
},
{
"path": "examples/inline/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/inline/readme.md",
"chars": 164,
"preview": "# isomorphic pug example\n\nThis example shows how to use a different template engine (in this case pug)\nto load the `time"
},
{
"path": "examples/inline/template.pug",
"chars": 401,
"preview": "doctype html\nhtml\n head\n meta(charset=\"utf-8\")\n title #{htmlWebpackPlugin.options.title}\n body\n each cssFile "
},
{
"path": "examples/inline/webpack.config.js",
"chars": 850,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/javascript/dist/webpack-5/bundle.js",
"chars": 2378,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 48\n(module) {\n\n\"use strict\";\n// This"
},
{
"path": "examples/javascript/dist/webpack-5/index.html",
"chars": 202,
"preview": "<head><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"stylesheet\"></head>Hello World from ba"
},
{
"path": "examples/javascript/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/javascript/example.js",
"chars": 166,
"preview": "require(\"./main.css\");\n\nvar universal = require(\"./universal.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML ="
},
{
"path": "examples/javascript/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/javascript/partial.html",
"chars": 40,
"preview": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
},
{
"path": "examples/javascript/readme.md",
"chars": 172,
"preview": "# isomorphic javascript example\n\nThis example shows how to generate a template on the fly using javascript.\n\nThe best wa"
},
{
"path": "examples/javascript/template.js",
"chars": 226,
"preview": "// Webpack require:\nvar partial = require(\"./partial.html\").default;\nvar universal = require(\"./universal.js\");\n\n// Expo"
},
{
"path": "examples/javascript/universal.js",
"chars": 302,
"preview": "// This file is used for frontend and backend\n\"use strict\";\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_P"
},
{
"path": "examples/javascript/webpack.config.js",
"chars": 754,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/javascript-advanced/dist/webpack-5/bundle.js",
"chars": 3439,
"preview": "/*\n * ATTENTION: The \"eval\" devtool has been used (maybe by default in mode: \"development\").\n * This devtool is neither "
},
{
"path": "examples/javascript-advanced/dist/webpack-5/index.html",
"chars": 232,
"preview": "<html><head><title>Webpack App</title><script defer=\"defer\" src=\"bundle.js\"></script><link href=\"styles.css\" rel=\"styles"
},
{
"path": "examples/javascript-advanced/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/javascript-advanced/example.js",
"chars": 166,
"preview": "require(\"./main.css\");\n\nvar universal = require(\"./universal.js\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML ="
},
{
"path": "examples/javascript-advanced/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/javascript-advanced/partial.html",
"chars": 40,
"preview": "<h2>Partial</h2>\n<img src=\"logo.png\" />\n"
},
{
"path": "examples/javascript-advanced/readme.md",
"chars": 168,
"preview": "# isomorphic javascript-advanced example\n\nThis example is similar to the javascript example however it allows takes\npara"
},
{
"path": "examples/javascript-advanced/template.js",
"chars": 491,
"preview": "// Webpack require:\nvar partial = require(\"./partial.html\").default;\nvar universal = require(\"./universal.js\");\n\n// Expo"
},
{
"path": "examples/javascript-advanced/universal.js",
"chars": 302,
"preview": "// This file is used for frontend and backend\n\"use strict\";\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_P"
},
{
"path": "examples/javascript-advanced/webpack.config.js",
"chars": 794,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/multi-page/dist/webpack-5/first.html",
"chars": 262,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/multi-page/dist/webpack-5/first.js",
"chars": 13893,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webp"
},
{
"path": "examples/multi-page/dist/webpack-5/second.html",
"chars": 262,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>Webpack App</title><meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/multi-page/dist/webpack-5/second.js",
"chars": 13893,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 192\n(__unused_webpack_module, __webp"
},
{
"path": "examples/multi-page/first.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/multi-page/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/multi-page/readme.md",
"chars": 78,
"preview": "# zero-config example\n\nin this example only the default configuration is used\n"
},
{
"path": "examples/multi-page/second.js",
"chars": 124,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h"
},
{
"path": "examples/multi-page/webpack.config.js",
"chars": 634,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package"
},
{
"path": "examples/pug-loader/dist/webpack-5/bundle.js",
"chars": 10196,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 355\n(__unused_webpack_module, export"
},
{
"path": "examples/pug-loader/dist/webpack-5/index.html",
"chars": 332,
"preview": "<!doctype html><html><head><title>pug demo</title><link rel=\"icon\" href=\"favicon.ico\"><script defer=\"defer\" src=\"bundle."
},
{
"path": "examples/pug-loader/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/pug-loader/example.js",
"chars": 282,
"preview": "\"use strict\";\nrequire(\"./main.css\");\n// Use the same template for the frontend code\nvar template = require(\"./time.pug\")"
},
{
"path": "examples/pug-loader/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/pug-loader/readme.md",
"chars": 164,
"preview": "# isomorphic pug example\n\nThis example shows how to use a different template engine (in this case pug)\nto load the `time"
},
{
"path": "examples/pug-loader/template.pug",
"chars": 156,
"preview": "doctype html\nhtml\n head\n title= htmlWebpackPlugin.options.title\n body\n #main\n - locals.time = new Date('01 "
},
{
"path": "examples/pug-loader/time.pug",
"chars": 137,
"preview": "// this partial is used for frontend and backend\n.time \n b Current time\n p #{time.toISOString()}\n \nimg(src=\"#{require"
},
{
"path": "examples/pug-loader/webpack.config.js",
"chars": 859,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/sort-manually/a.js",
"chars": 114,
"preview": "require(\"./main.css\");\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"a!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/sort-manually/b.js",
"chars": 91,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"b!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/sort-manually/c.js",
"chars": 91,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"c!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/sort-manually/d.js",
"chars": 91,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"d!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/sort-manually/dist/webpack-5/a.js",
"chars": 1992,
"preview": "/******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 969\n(__unused_webpack_module, __webp"
},
{
"path": "examples/sort-manually/dist/webpack-5/b.js",
"chars": 145,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"b!\";\ndocument.body.appendCh"
},
{
"path": "examples/sort-manually/dist/webpack-5/c.js",
"chars": 145,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"c!\";\ndocument.body.appendCh"
},
{
"path": "examples/sort-manually/dist/webpack-5/d.js",
"chars": 145,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"d!\";\ndocument.body.appendCh"
},
{
"path": "examples/sort-manually/dist/webpack-5/e.js",
"chars": 145,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"e!\";\ndocument.body.appendCh"
},
{
"path": "examples/sort-manually/dist/webpack-5/first-file.html",
"chars": 390,
"preview": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content"
},
{
"path": "examples/sort-manually/dist/webpack-5/second-file.html",
"chars": 390,
"preview": "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><title>Example template</title><meta name=\"viewport\" content"
},
{
"path": "examples/sort-manually/dist/webpack-5/styles.css",
"chars": 30,
"preview": "body {\n background: snow;\n}\n\n"
},
{
"path": "examples/sort-manually/e.js",
"chars": 91,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"e!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/sort-manually/main.css",
"chars": 29,
"preview": "body {\n background: snow;\n}\n"
},
{
"path": "examples/sort-manually/template.html",
"chars": 246,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Example template</title>\n <meta nam"
},
{
"path": "examples/sort-manually/webpack.config.js",
"chars": 1158,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar MiniCssExtractPlugin = require(\"mini-css-extra"
},
{
"path": "examples/template-parameters/dist/webpack-5/bundle.js",
"chars": 155,
"preview": "/******/ (() => { // webpackBootstrap\nvar h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.bod"
},
{
"path": "examples/template-parameters/dist/webpack-5/index.html",
"chars": 141,
"preview": "<!doctype html><html><head><meta charset=\"utf-8\"><title>bar</title><script defer=\"defer\" src=\"bundle.js\"></script></head"
},
{
"path": "examples/template-parameters/example.js",
"chars": 101,
"preview": "var h1 = document.createElement(\"h1\");\nh1.innerHTML = \"Hello world!\";\ndocument.body.appendChild(h1);\n"
},
{
"path": "examples/template-parameters/index.ejs",
"chars": 126,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title><%= foo %></title>\n </head>\n <body>\n </body>\n</"
},
{
"path": "examples/template-parameters/readme.md",
"chars": 105,
"preview": "# template parameters example\n\nThis example shows how you can overwrite the built in template parameters\n"
},
{
"path": "examples/template-parameters/webpack.config.js",
"chars": 1014,
"preview": "var path = require(\"path\");\nvar HtmlWebpackPlugin = require(\"../..\");\nvar webpackMajorVersion = require(\"webpack/package"
},
{
"path": "flow.puml",
"chars": 1135,
"preview": "@startuml\n' See docs http://plantuml.com/sequence.html\n'\n' generate png:\n' npm run puml\nautonumber\n\nparticipant Webpack\n"
},
{
"path": "index.js",
"chars": 48957,
"preview": "// @ts-check\n\"use strict\";\n\nconst promisify = require(\"util\").promisify;\n\nconst vm = require(\"vm\");\nconst fs = require(\""
},
{
"path": "lib/cached-child-compiler.js",
"chars": 15252,
"preview": "// @ts-check\n/**\n * @file\n * Helper plugin manages the cached state of the child compilation\n *\n * To optimize performan"
},
{
"path": "lib/child-compiler.js",
"chars": 8761,
"preview": "// @ts-check\n\"use strict\";\n\n/**\n * @file\n * This file uses webpack to compile a template with a child compiler.\n *\n * [T"
},
{
"path": "lib/chunksorter.js",
"chars": 1255,
"preview": "// @ts-check\n\"use strict\";\n\n/** @typedef {import(\"webpack\").Compilation} Compilation */\n\n/**\n * @type {{[sortmode: strin"
},
{
"path": "lib/errors.js",
"chars": 1153,
"preview": "// @ts-nocheck\n\"use strict\";\n\nlet prettyError;\n\nfunction getPrettyError() {\n if (!prettyError) {\n // lazily require "
},
{
"path": "lib/hooks.js",
"chars": 191,
"preview": "// TODO remove in the next major release\nconst plugin = require(\"../index\");\n\nmodule.exports = {\n getHtmlWebpackPluginH"
},
{
"path": "lib/html-tags.js",
"chars": 3364,
"preview": "// @ts-check\n/** @typedef {import(\"../typings\").HtmlTagObject} HtmlTagObject */\n/**\n * @file\n * This file provides to he"
},
{
"path": "lib/loader.js",
"chars": 1725,
"preview": "/* This loader renders the template with underscore if no other loader was found */\n// @ts-nocheck\n\"use strict\";\nconst _"
},
{
"path": "lint-staged.config.js",
"chars": 164,
"preview": "module.exports = {\n \"*\": [\n \"prettier --cache --write --ignore-unknown\",\n \"cspell --cache --no-must-find-files\",\n"
},
{
"path": "logs",
"chars": 827,
"preview": "<i> [webpack-dev-server] Project is running at:\n<i> [webpack-dev-server] Loopback: http://localhost:8080/\n<i> [webpack-d"
},
{
"path": "migration.md",
"chars": 4723,
"preview": "# Migrating from 1.x to 2.x\n\n## Default config\n\nhttps://github.com/ampedandwired/html-webpack-plugin/tree/master/example"
},
{
"path": "package.json",
"chars": 3198,
"preview": "{\n \"name\": \"html-webpack-plugin\",\n \"version\": \"5.6.6\",\n \"license\": \"MIT\",\n \"description\": \"Simplifies creation of HT"
},
{
"path": "spec/basic.spec.js",
"chars": 102541,
"preview": "/*\n * Integration and unit tests for all features but caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = req"
},
{
"path": "spec/caching.spec.js",
"chars": 10772,
"preview": "/*\n * Integration tests for caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst webpac"
},
{
"path": "spec/example.spec.js",
"chars": 3307,
"preview": "/*\n * These integration tests compile all cases from the example folder\n * and matches them against their dist folder\n *"
},
{
"path": "spec/fixtures/async.js",
"chars": 40,
"preview": "'use strict';\nmodule.exports = 'async';\n"
},
{
"path": "spec/fixtures/common.js",
"chars": 42,
"preview": "'use strict';\n\nmodule.exports = 'common';\n"
},
{
"path": "spec/fixtures/empty.html",
"chars": 0,
"preview": ""
},
{
"path": "spec/fixtures/empty_html.html",
"chars": 0,
"preview": ""
},
{
"path": "spec/fixtures/html-template-with-image.html",
"chars": 182,
"preview": "<!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<di"
},
{
"path": "spec/fixtures/index.js",
"chars": 168,
"preview": "'use strict';\n\nrequire('./common');\n\nrequire.ensure([], function () {\n require('./async');\n});\n\ndocument.body.innerHTML"
},
{
"path": "spec/fixtures/interpolation.html",
"chars": 183,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n <title>{%= htmlWebpackPlugin.options.title %}</title>\n "
},
{
"path": "spec/fixtures/invalid.html",
"chars": 190,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n <title>Test</title>\n </head>\n <body>\n <p>Some uniqu"
},
{
"path": "spec/fixtures/logo.html",
"chars": 254,
"preview": "<!doctype html>\n<html lang=\"en\" manifest=\"foo.appcache\">\n<head>\n <meta charset=\"utf-8\">\n <title>Example Plain file</ti"
},
{
"path": "spec/fixtures/main.css",
"chars": 28,
"preview": "body {\n background: snow;\n}"
},
{
"path": "spec/fixtures/plain.html",
"chars": 227,
"preview": "<!doctype html>\n<html lang=\"en\" manifest=\"foo.appcache\">\n<head>\n <meta charset=\"utf-8\">\n <title>Example Plain file</ti"
},
{
"path": "spec/fixtures/spaced_plain.html",
"chars": 97,
"preview": "<!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",
"chars": 270,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n <meta name=\"viewport\" content=\"width=device-width,initia"
},
{
"path": "spec/fixtures/template-partial.hbs",
"chars": 19,
"preview": "<div>Partial</div>\n"
},
{
"path": "spec/fixtures/template.ejs",
"chars": 394,
"preview": "<!DOCTYPE html>\n<html>\n <head></head>\n <body>\n <div id=\"react-app\"></div>\n <% for (item of htmlWebpackPlugin.fil"
},
{
"path": "spec/fixtures/template.hbs",
"chars": 270,
"preview": "<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title>Demo</title>\n </head>\n <body>\n <p>Some unique"
},
{
"path": "spec/fixtures/template.pug",
"chars": 168,
"preview": "doctype html\nhtml\n head\n meta(charset=\"utf-8\")\n title Demo\n body\n p Some unique text\n each jsFile in htmlW"
},
{
"path": "spec/fixtures/templateParam.cjs",
"chars": 537,
"preview": "module.exports = function (templateParams) {\n const version = parseInt(process.version.match(/^v(\\d+)/)[1]);\n\n if (typ"
},
{
"path": "spec/fixtures/templateParam.js",
"chars": 537,
"preview": "module.exports = function (templateParams) {\n const version = parseInt(process.version.match(/^v(\\d+)/)[1]);\n\n if (typ"
},
{
"path": "spec/fixtures/test.html",
"chars": 212,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n <title>Test</title>\n </head>\n <body>\n <p>Some uniqu"
},
{
"path": "spec/fixtures/theme.js",
"chars": 61,
"preview": "'use strict';\n\nrequire('./main.css');\nrequire('./index.js');\n"
},
{
"path": "spec/fixtures/util.js",
"chars": 106,
"preview": "'use strict';\n\nrequire('./common');\ndocument.body.innerHTML = document.body.innerHTML + '<p>util.js</p>';\n"
},
{
"path": "spec/fixtures/webpackconfig.html",
"chars": 251,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n <title>Test</title>\n </head>\n <body>\n <p>Public pat"
},
{
"path": "spec/hot.spec.js",
"chars": 9872,
"preview": "/*\n * Integration tests for caching\n */\n\n/* eslint-env jest */\n\"use strict\";\n\nconst path = require(\"path\");\nconst fs = r"
},
{
"path": "tsconfig.json",
"chars": 2102,
"preview": "{\n \"compilerOptions\": {\n /* Basic Options */\n \"allowJs\": true /* Allow javascript files to be compiled. */,\n \""
},
{
"path": "typings.d.ts",
"chars": 8209,
"preview": "import { AsyncSeriesWaterfallHook } from \"tapable\";\nimport { Compiler, Compilation } from \"webpack\";\nimport { Options as"
}
]
About this extraction
This page contains the full source code of the jantimon/html-webpack-plugin GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 187 files (441.4 KB), approximately 112.7k tokens, and a symbol index with 124 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.