vite
vite copied to clipboard
vite build alters the <link> tag wrongly
Describe the bug
I am compiling my .html file with the command vite build, and when I see the final code, specifically the <link>
tags that are in <head>
, they are different because it erases the attributes that I added.
What I was expecting is this final code:
<link rel=“preload” as=“style” onload=“this.onload=null;this.rel=‘stylesheet’” href=“./assets/index-CjVjCqpO.css”>
What really happened...
<link rel=“stylesheet” crossorigin href=“./assets/index-CjVjCjCqpO.css”>
Reproduction
https://stackblitz.com/edit/vitejs-vite-2k4shi?file=dist%2Findex.html
Steps to reproduce
just run npm run build
and see the generated html code and compare it with the original
System Info
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 AMD Ryzen 5 5600G with Radeon Graphics
Memory: 5.49 GB / 12.90 GB
Binaries:
Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (123.0.2420.97)
Internet Explorer: 11.0.19041.4355
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.