Skip to content

Instantly share code, notes, and snippets.

@eemeli
Created February 15, 2022 07:05
Show Gist options
  • Save eemeli/97b34dc72c886dffa25168699fe81e79 to your computer and use it in GitHub Desktop.
Save eemeli/97b34dc72c886dffa25168699fe81e79 to your computer and use it in GitHub Desktop.
Minimal reproduction for Vite bug with build.rollupOptions.external & <link rel="stylesheet">
<!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>
document.querySelector("#app").innerHTML = `
<h1>Hello Vite!</h1>
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a>
`;
{
"name": "vite-project",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^2.8.0"
}
}
#app {
text-align: center;
background: green;
color: #2c3e50;
}
export default {
build: { rollupOptions: { external: "/style.css" } },
};
@designervoid
Copy link

@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