Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctype is mutilated #123

Open
4 of 9 tasks
ttencate opened this issue Sep 3, 2024 · 2 comments
Open
4 of 9 tasks

Doctype is mutilated #123

ttencate opened this issue Sep 3, 2024 · 2 comments

Comments

@ttencate
Copy link

ttencate commented Sep 3, 2024

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.
@ttencate
Copy link
Author

ttencate commented Sep 3, 2024

The cause seems to be somewhere in cheerio or one of its dependencies: cheeriojs/cheerio#4068

@MarshallOfSound
Copy link

Pinning cheerio to 1.0.0-rc.10 fixed this for me (it was working, then I updated some deps and rolled them back till it worked again)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants