简体   繁体   English

错误:html-webpack-plugin 无法缩小生成的输出

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

while deploying to heroku i am getting following error .在部署到 heroku 时,我收到以下错误。 i am unable to resolve it as i dont know anything about html-webpack-plugin.我无法解决它,因为我对 html-webpack-plugin 一无所知。 help please.请帮忙。 my codes-https://github.com/utkarsh-cmd/Shop_INN我的代码-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:          |

This may be happened because of a syntax error in index.html(inside public folder).这可能是由于 index.html(公共文件夹内)中的语法错误而发生的。 Eg: missing tag in index.html例如:index.html 中缺少标签

In my case error was:-就我而言,错误是:-

Error: html-webpack-plugin could not minify the generated output.错误:html-webpack-plugin 无法缩小生成的输出。 In production mode the html minifcation is enabled by default.在生产模式下,默认情况下启用 html 缩小。
If you are not generating a valid html output please disable it man ually.如果您没有生成有效的 html 输出,请手动禁用它。 You can do so by adding the following setting to your HtmlWebpackPl ugin config: |您可以通过将以下设置添加到您的 HtmlWebpackPl ugin 配置来实现: | | | minify: false |缩小:假 | See https://github.com/jantimon/html-webpack-plugin#options for det ails.有关详细信息,请参阅https://github.com/jantimon/html-webpack-plugin#options 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" />对于解析器专用错误,请在此处创建问题: https : //danielruf.github.io/html-minifier-terser/解析错误:<meta name="viewport" content="user-scalable="no" />
... ...

As you can see on line 6 in public/index.html正如你在public/index.html第 6 行看到的

<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.再次yarn run build. and problem solved.并解决了问题。

It can be a syntax error, like a missed quote or closing tag inside your file.html.它可能是一个语法错误,比如在 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.我建议您将代码传递到 HTML 验证器或调试器中,自动检查 html 错误可以为您节省大量时间。 I used this one and solved the tiny bug:我使用了这个并解决了这个小错误:

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

最好的方法是编辑您的 index.html 并修复错误,我建议使用https://jsonformatter.org/html-validator来修复 .html 文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 html-webpack-plugin输出html,内部主体为空 - html-webpack-plugin output html , interior body empty 带有 html-webpack-plugin 的 Webpack,全局安装时出错 - Webpack with html-webpack-plugin, error when installed globally npm 运行 html-webpack-plugin 的构建错误 - npm run build error for html-webpack-plugin 使用html-webpack-plugin在开发模式下在webpack中构建HTML - Build HTML in webpack in dev mode with html-webpack-plugin html-webpack-plugin 是否在劫持我的 Express 服务器? - Is html-webpack-plugin hijacking my express server? 如何在 html-webpack-plugin 中注入自定义元标记? - How to inject custom meta tags in html-webpack-plugin? 找不到模块:错误:无法解析“/node_modules/html-webpack-plugin/lib/loader.js” - Module not found: Error: Can't resolve '/node_modules/html-webpack-plugin/lib/loader.js' 如何使用 html-webpack-plugin 在我的模板 html 中为 webpack 包含脚本标签 - How can I include a script tag in my template html for webpack with html-webpack-plugin html-webpack-plugin-如何在不执行EJS模板的情况下插入webpack bundle.js - html-webpack-plugin - How to insert webpack bundle.js without executing the EJS template eslint 'html-webpack-plugin' 应该列在项目的依赖中,而不是 devDependencies 中。 (导入/无外部依赖项) - eslint 'html-webpack-plugin' should be listed in the project's dependencies, not devDependencies. (import/no-extraneous-dependencies)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM