Skip to content

HTML transformer deletes tags #10212

@bitbof

Description

@bitbof

🐛 bug report

building an html file, the resulting file is missing tags. E.g. an opening and closing span tag with its content.

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

Fresh install of parcel:

{
  "source": "src/index.html",
  "scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
  "dependencies": {
    "parcel": "^2.15.4"
  }
}

one html file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Page</title>
</head>
<body>
<svg style="width: 37px; margin-right: 4px; margin-top: -3px" viewBox="0 0 63 63">
    <path
            fill="#eee"
            d="M1.6 1s4.4.7 11.1 3.4C16.5 6 24 10.2 24.2 15.2c.2 5-4.2 5.2-8.5 12.7a22 22 0 0 0 2 24.3A26 26 0 0 0 33 61.8c5.4 1.1 10.8.4 12.5-.2a7.5 7.5 0 0 0 5-5c.8-2.8-.1-2.4-3-2.2-3.1.2-8.4 0-13.5-3.1-4-2.4-6-5.8-6.6-8.6 0 0 2.2 3.1 9.6 5.5 7.3 2.2 13 .5 14.6-.8 1.5-1.2-.1-3.3-.1-3.3s2.9-1.2 4.1-2.5c1.8-1.9-.2-3.1-2.9-6.2-1.7-2-3.2-4.2-3.2-4.2s2-1.2 3.7-3.2c1.4-1.8 4-6 2.8-11.7-1.3-7-8.9-12.7-16.4-14.1A69 69 0 0 0 22.9 1Zm39 25.7c2.1-.1 4 3 4.2 7 .3 3.9-1.2 7.2-3.3 7.3-2 .1-4-3-4.2-7-.2-3.9 1.3-7.2 3.4-7.3z"
    />
</svg>
<span>Hello</span>
</body>
</html>

build: npm run build

🤔 Expected Behavior

While minified, not optional tags are kept.

😯 Current Behavior

all tags following the svg turn into an empty line. The span is gone.

<!DOCTYPE html><html lang=en><meta charset=UTF-8><title>Page</title><body>
<svg style=width:37px;margin-top:-3px;margin-right:4px viewBox="0 0 63 63"><path fill=#eee d="M1.6 1s4.4.7 11.1 3.4C16.5 6 24 10.2 24.2 15.2s-4.2 5.2-8.5 12.7a22 22 0 0 0 2 24.3A26 26 0 0 0 33 61.8c5.4 1.1 10.8.4 12.5-.2a7.5 7.5 0 0 0 5-5c.8-2.8-.1-2.4-3-2.2-3.1.2-8.4 0-13.5-3.1-4-2.4-6-5.8-6.6-8.6 0 0 2.2 3.1 9.6 5.5 7.3 2.2 13 .5 14.6-.8 1.5-1.2-.1-3.3-.1-3.3s2.9-1.2 4.1-2.5c1.8-1.9-.2-3.1-2.9-6.2-1.7-2-3.2-4.2-3.2-4.2s2-1.2 3.7-3.2c1.4-1.8 4-6 2.8-11.7-1.3-7-8.9-12.7-16.4-14.1A69 69 0 0 0 22.9 1Zm39 25.7c2.1-.1 4 3 4.2 7 .3 3.9-1.2 7.2-3.3 7.3-2 .1-4-3-4.2-7-.2-3.9 1.3-7.2 3.4-7.3Z"/></svg>

💁 Possible Solution

/

🔦 Context

I can't build my website.

💻 Code Sample

see above

🌍 Your Environment

Software Version(s)
Parcel 2.15.4
Node 22.18.0
npm/Yarn npm 9.8.0
Operating System win 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions