templateContent field causes abnormal behaviour of yauzl module (!?)
This is quite likely not html-webpack-plugin's fault, but a peculiar behaviour I observed quite consistently.
Situation: html-webpack-plugin @3.2.0, Electron @7, Node @12. Ancient stuff. But do read on.
State 1: App works like a charm. Unzips a static zip as part of its functionality.
Change: I add "templateContent": "foo" to a webpack config file, and build a production app.
State 2: App's extract-zip module, using yauzl module, gets bogus filenames from the zip.
Remove templateContent, app's back to normal. Add even an empty string "", app gets malformed zip filenames again.
This might be an ancient problem, but WHY would it appear is a mystery - but perhaps the underlying problem is still in there?
Issue narrowed down to yauzl using an utf8 string as template for CP437-to-Unicode conversion - but the issue remains (or remained): the yauzl module code gets interpreted as single-byte encoding (CP1250, ISO-8859-1, what have you) by Electron if the HTML file produced by html-webpack-plugin doesn't have <meta charset="utf-8">, and - in case of an empty templateContent - is just <script src="bundle.js"></script>.
The question remains: is it html-webpack-plugin's responsibility to ensure the HTMLs are utf-8 encoded, and an empty templateContent is an unequivocal assault on that notion, or is it old Electron's old Chromium's fault for interpreting scripts with the same encoding as the HTML that called them?
is it html-webpack-plugin's responsibility to ensure the HTMLs are utf-8 encoded
No, but we use this by default and as a recommendation, looks like you need a valid setup for terser/swc, mostly it is due minification, if you need better answer please create reproducible test repo
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!