jantimon/html-webpack-plugin

Script injection tries to add <head> tag by default

faissalbyld opened this issue · 1 comments

Current behaviour 💣

HTML templates without a <head> get a <head> tag prepended to them. A temporary workaround is to specify inject: 'body'.

Expected behaviour ☀️

A head tag should not be added where there was not one previously.

Reproduction Example 👾

Plugin settings:

			new HtmlWebpackPlugin({
				template: 'index.html',
			}),

In index.html:
<div>my headless, bodyless html template</div>
Ends up being transformed into:
<head><div>my headless, bodyless html template</div>

Environment 🖥

Node.js v16.10.0
linux 5.13.0-39-generic
7.24.0

Hello, sorry for delay, it is no a bug, expected, by default we inject chunks into head, we don't know is it HTML document or HTML template, so you need to inject: 'body' to prevent it or just disable it, feel free to feedback