Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

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

Closed
3 tasks done
carlos22 opened this issue Dec 4, 2023 · 7 comments · Fixed by #120
Closed
3 tasks done

Comments

@carlos22
Copy link

carlos22 commented Dec 4, 2023

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

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a unplugin-vue-ce issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs instead.
  • The provided reproduction is a minimal reproducible example of the bug.
Copy link

stackblitz bot commented Dec 4, 2023

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

@baiwusanyu-c
Copy link
Member

image
image
image
I need more information to reproduce the problem

@baiwusanyu-c
Copy link
Member

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

@carlos22
Copy link
Author

carlos22 commented Dec 6, 2023

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 carlos22 changed the title [BUG] - import "./some-lib.css" seems not to end up in the shadow-root [BUG] - ES modules import "./some-lib.css" seems not to end up in the shadow-root Dec 6, 2023
@carlos22
Copy link
Author

carlos22 commented Dec 6, 2023

grafik
grafik

@carlos22
Copy link
Author

carlos22 commented Dec 6, 2023

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

@carlos22
Copy link
Author

Cool, thanks for the fast fix :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants