jantimon / html-webpack-plugin

Simplifies creation of HTML files to serve your webpack bundles
MIT License
10.71k stars 1.31k forks source link

Plugin option `title` doesn't work #1770

Closed megFree closed 2 years ago

megFree commented 2 years ago

Current behaviour 💣

Plugin option title doesn't insert new title for output html template.

Expected behaviour ☀️

Plugin adds provided title tag into resulting html file.

Reproduction Example 👾

Github repo

  1. Clone
  2. npm install
  3. npm start
  4. Check out result html

Environment 🖥

Node.js v16.6.2
win32 10.0.19043
npm 7.20.3

npm ls webpack

code@1.0.0 C:\my_projects\webpack-demo-app
+-- css-loader@6.7.1
| `-- webpack@5.74.0 deduped
+-- html-webpack-plugin@5.5.0
| `-- webpack@5.74.0 deduped
+-- sass-loader@13.1.0
| `-- webpack@5.74.0 deduped
+-- style-loader@3.3.1
| `-- webpack@5.74.0 deduped
+-- webpack-cli@4.10.0
| +-- @webpack-cli/configtest@1.2.0
| | `-- webpack@5.74.0 deduped
| `-- webpack@5.74.0 deduped
`-- webpack@5.74.0
  `-- terser-webpack-plugin@5.3.6
    `-- webpack@5.74.0 deduped

npm ls html-webpack-plugin

code@1.0.0 C:\my_projects\webpack-demo-app
`-- html-webpack-plugin@5.5.0
byverdu commented 2 years ago

I believe you're missing this bit in your html file <title><%= htmlWebpackPlugin.options.title %></title> as stated in writing-your-own-templates