Incorrect HTML output after build in Parcel v2.15 — HTML structure is flattened and invalid #10198
Replies: 2 comments
-
This is indeed valid html. The closing tags are optional according to the specification. Can you describe what is broken? |
Beta Was this translation helpful? Give feedback.
-
Hi Devon, Thanks for the feedback.
To be honest, I wasn’t aware that the omission of certain closing tags is allowed by the HTML specification.
I focused on the tag structure because in a previous version of Parcel (2.15.0 or 2.15.1), I had encountered an issue where the tag was omitted during build, which caused problems with Unicode character encoding. Since we’re on the topic, I noticed that while the generated HTML is valid, it doesn’t appear to be fully minified — for example, some whitespace and line breaks remain. Is there a recommended way to control or enforce stricter minification for HTML in Parcel? Thanks again for your support and insights! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m experiencing an issue with my application after upgrading to Parcel v2.15, which can be easily reproduced with the following setup.
Given a simple HTML file like this:
And a package.json build script like this:
After running npm run build, the generated output becomes:
This output is not valid HTML (missing closing tags, tag content moved out of place), and it breaks my application in certain environments that strictly parse HTML.
From what I read in the Parcel v2.15.0 release notes, this might be related to the introduction or update of htmlnano as the default HTML minifier.
I tried customizing or disabling htmlnano via a .posthtmlrc file like this, but without success:
Is there a recommended way to preserve valid HTML structure in Parcel builds under v2.15?
Any insight or workaround would be appreciated.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions