Created
February 15, 2022 07:05
-
-
Save eemeli/97b34dc72c886dffa25168699fe81e79 to your computer and use it in GitHub Desktop.
Minimal reproduction for Vite bug with build.rollupOptions.external & <link rel="stylesheet">
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="/style.css" /> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script type="module" src="/main.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector("#app").innerHTML = ` | |
<h1>Hello Vite!</h1> | |
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a> | |
`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "vite-project", | |
"private": true, | |
"scripts": { | |
"dev": "vite", | |
"build": "vite build", | |
"preview": "vite preview" | |
}, | |
"devDependencies": { | |
"vite": "^2.8.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app { | |
text-align: center; | |
background: green; | |
color: #2c3e50; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
build: { rollupOptions: { external: "/style.css" } }, | |
}; |
@eemeli in the dist/index.html
should be link
with href="/style.css"
?
@designervoid Yes; the <link>
should not get removed, as the resource it's pointing at is marked as external.
@eemeli such a great feature.
I solved this problem with htmlPlugin
, temporarily.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Filed as issue: vitejs/vite#6931