On custom element 'link css' does not build css. #10561
-
Hello I write in template link css like this, for web component doc
this work in dev mode, but does not work after build, css is empty On documentation web component support external css via link Steps to reproduce npm run build how can resolve this problem ? i create bug report on this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
🛠 Ensure that the path you're using in the 🛠 For Vite and similar tools, investigate how to configure the tool to ensure assets referenced in web components are correctly processed. Vite has features for handling static assets, but you might need to use specific plugins or configuration options to include assets referenced in this way. 🛠 Consider using Constructable Stylesheets in your web component. 🛠 Inline CSS as a Workaround |
Beta Was this translation helpful? Give feedback.
-
I fix it. <template>
<link rel="stylesheet" :href="url" />
<div class="red">
<h1>red</h1>
</div>
</template>
<script lang="ts" setup>
import url from "./style.css?url"
</script> |
Beta Was this translation helpful? Give feedback.
I fix it.
if you import style with ?url, css will build.