Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: can't disable normalizeAttr/cleanAttributeValue #191

Open
slorber opened this issue Dec 20, 2024 · 0 comments
Open

[Bug]: can't disable normalizeAttr/cleanAttributeValue #191

slorber opened this issue Dec 20, 2024 · 0 comments

Comments

@slorber
Copy link

slorber commented Dec 20, 2024

What happened?

There is no way to opt-out of attribute normalization.

The problem is that transforming class=" xyz " to class="xyz" can lead to React hydration errors, and the minifier does not give us any escape hatch option to turn this normalization off.

Of course, it's better to not have such useless whitespace in the markup in the first place, but sometimes that extra whitespace comes from a third-party npm package and you can't easily fix it in userland.

Here's an example I encountered on the Docusaurus website:

CleanShot 2024-12-20 at 23 08 40@2x

Note that @swc/html minifier has such an option already: normalizeAttributes: false,

Version

7.2.0

What browsers are you seeing the problem on?

No response

Link to reproduce

No response

Relevant log output

No response

Willing to submit a PR?

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant