Error: html-webpack-plugin could not minify the generated output

Viewed 3777

while deploying to heroku i am getting following error . i am unable to resolve it as i dont know anything about html-webpack-plugin. help please. my codes-https://github.com/utkarsh-cmd/Shop_INN

Creating an optimized production build...
    remote:        Failed to compile.
    remote:
    remote:        Error: html-webpack-plugin could not minify the generated output.
    remote:          In production mode the html minifcation is enabled by default.
    remote:          If you are not generating a valid html output please disable it manually.
    remote:          You can do so by adding the following setting to your HtmlWebpackPlugin config  :
    remote:          |
    remote:          |    minify: false
    remote:          |
4 Answers

This may be happened because of a syntax error in index.html(inside public folder). Eg: missing tag in index.html

In my case error was:-

Error: html-webpack-plugin could not minify the generated output. In production mode the html minifcation is enabled by default.
If you are not generating a valid html output please disable it man ually. You can do so by adding the following setting to your HtmlWebpackPl ugin config: | | minify: false | See https://github.com/jantimon/html-webpack-plugin#options for det ails. For parser dedicated bugs please create an issue here: https://danielruf.github.io/html-minifier-terser/ Parse Error: <meta name="viewport" content="user-scalable="no" />
...

As you can see on line 6 in public/index.html

<meta name="viewport" content="user-scalable="no" />  (I previously made change to it)

this was the actual problem

So I replaced this with

<meta name="viewport" content="width=device-width, initial-scale=1.0" />(this is defualt one)

again yarn run build. and problem solved.

It can be a syntax error, like a missed quote or closing tag inside your file.html.

I recommend you to pass in your code into an HTML Validator or debugger, the automated check of errors for html can save you a lot of time. I used this one and solved the tiny bug:

https://www.freeformatter.com/html-validator.html

Related