Skip to content

Doctype is mutilated #123

@ttencate

Description

@ttencate

Description

The HTML output has an invalid doctype line like this:

<!DOCTYPE >

This happens even with an extremely minimal configuration file, see below.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackhq/csp-html-webpack-plugin version: 5.1.0

node version: v22.5.1

OS version(s): Arch Linux

Steps to reproduce:

$ git clone https://github.com/ttencate/csp-html-webpack-plugin_doctype_repro.git
$ cd csp-html-webpack-plugin_doctype_repro
$ yarn install
$ ./node_modules/.bin/webpack
$ head -n1 dist/index.html

Expected result:

<!DOCTYPE html>

Actual result:

<!DOCTYPE >

Attachments:

package.json

{
  "name": "repro",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "csp-html-webpack-plugin": "^5.1.0",
    "html-webpack-plugin": "^5.6.0",
    "webpack": "^5.94.0",
    "webpack-cli": "^5.1.4"
  }
}

webpack.config.js

const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: 'development',
  plugins: [
    new HtmlWebpackPlugin(),
    new CspHtmlWebpackPlugin(),
  ],
}

src/index.js

// Empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions