#10365·parcel

New HTML packager is broken

Author: solonovamaxCreated Sep 21, 2026Updated Sep 29, 2026

bug report

The new HTML packager will just reorder tags it thinks are "invalid". This can affect templating tools like thymeleaf.

It also just seems to not emit the <head> tag for some reason in my reproduction sample??

Configuration (.babelrc, package.json, cli command)

To reproduce this, create a new parcel project with pnpm create parcel vanilla reproduction, then modify the src/index.html with the below changes.

Expected Behavior

Given something like

xml
<!doctype html>
<html lang="en" xmlns:layout="https://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Parcel Vanilla App</title>
    <link rel="stylesheet" href="style.css">
    <th:block th:insert="~{templates/fragments/common-head :: commonHead(${title}, ${description}, ~{:: #extra-head})}"/>
    <th:block id="extra-head"></th:block>
  </head>
  <body>
    <h1>Parcel Vanilla App</h1>
    <p>Edit <code>src/index.html</code> to get started!</p>
  </body>
</html>

The emitted html would be roughly similar

Current Behavior

It instead emits:

xml
<!DOCTYPE html><html lang=en xmlns:layout=https://www.ultraq.net.nz/thymeleaf/layout xmlns:th=http://www.thymeleaf.org><meta charset=utf-8><meta name=viewport content="width=device-width, initial-scale=1.0"><title>Parcel Vanilla App</title><link rel=stylesheet href=/reproduction.d064d61f.css><th:block th:insert="~{templates/fragments/common-head :: commonHead(${title}, ${description}, ~{:: #extra-head})}">
    <th:block id=extra-head></th:block>
  
  
    <h1>Parcel Vanilla App</h1>
    <p>Edit <code>src/index.html</code> to get started!</p>
  

</th:block>

Issues:

  • the first th:block tag was closed with />. for some reason, it decided that actually it wasn't closed and that EVERYTHING else is part of it.
  • removed the <head> and <body> tags entirely?? (when initially encountered, it did not do this, it just moved the <th:block> tags from the <head> into the <body>
  • does not close the <html> tag
  • I don't think xmlns:layout=https://www.ultraq.net.nz/thymeleaf/layout is a valid attribute, but I could be wrong.

When I originally encountered this, I did not encounter the last two, but that might be because I was using the older @parcel/optimizer-htmlnano, so those may be caused by it.

Possible Solution

The issue has to do with how the old parcel HTML packager was ported from js to rust. As a temporary measure, I'm just going to vendor the old js packager.

Context

I am using Thymeleaf, which uses custom tags for templating.

Code Sample

See above.

Your Environment

Software Version(s)
Parcel 2.16.4
Node v26.9.0
npm/Yarn pnpm 9.12.0
Operating System Arch Linux 7.1.4-arch1-1 x86_64