unplugin / unplugin-vue-ce

🍒 A vue plugin that extends vue's Custom Element capabilities
MIT License
75 stars 3 forks source link

[BUG] - ES modules import "./some-lib.css" seems not to end up in the shadow-root #118

Closed carlos22 closed 9 months ago

carlos22 commented 9 months ago

Describe the bug

When using a library inside as child of your CE component that uses the ES modules import "./mylib.css" (in the <script> tag!) the css does not end up in the shadow dom but in the regular dom.

Reproduction

https://stackblitz.com/edit/vitejs-vite-nqrj24 (should work now)

System Info

No response

Used Package Manager

npm

Validations

stackblitz[bot] commented 9 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

baiwusanyu-c commented 9 months ago

image image image I need more information to reproduce the problem

baiwusanyu-c commented 9 months ago

Are you referring to a third-party component library (such as vuetify)?

carlos22 commented 9 months ago

Are you referring to a third-party component library (such as vuetify)?

For example. Anything that is imported with a import "style.css" in the head. This style will not end up in the shadow dom even if the import was done in a sub component. The example I provided seems to be the original one, sorry for that I had it working but might have lost the link somehow...

The important thing is NOT @import of CSS that works, but import of ES modules with css. E.g. with libs that use this one here: https://www.npmjs.com/package/vite-plugin-lib-inject-css

carlos22 commented 9 months ago

grafik grafik

carlos22 commented 9 months ago

This should explain the bug better: https://stackblitz.com/edit/vitejs-vite-nqrj24

carlos22 commented 8 months ago

Cool, thanks for the fast fix :)