#Trouble using scoped css with vue3 component library with vite

1 messages · Page 1 of 1 (latest)

wanton anchor
#

I have a vue3 component library that is building and working fine. However, if I use scoped css in the component, no styles are applied in the host project. I am importing the style.css file, the styles are present.

I see that the styles are all using [data-v-id=????] selectors, but the elements are missing such an attribute. If I remove scoped, everything works fine. I prefer to use scoped css.

This is my vite.config.js
https://github.com/btimby/stegman-vue/blob/master/vite.config.js

The host application is in a separate repository. I do have a demo vue app in the demo/ subdirectory above and it works fine with or without scoped css.

GitHub

Vue components for stegman. Contribute to btimby/stegman-vue development by creating an account on GitHub.

wanton anchor
#

Nevermind, I figured it out, though what I was doing should probably work...

#

I was installing via npm i file:../project-dir which was failing.