-
Notifications
You must be signed in to change notification settings - Fork 920
Open
Description
Version
16.8.1
Reproduction link
Steps to reproduce
git clone https://github.com/riovir/vue3-custom-element-child-sfc-styles.git
cd vue3-custom-element-child-sfc-styles
npm ci
npm start
Notice how there is no colored background applied to either child component. (One loaded as customElement, one loaded with default behavior.)
What is expected?
At least one of the child SFC components having its style applied. Preferably the one loaded as a regular component. This way only the outermost component needs to be loaded as a customElement.
What is actually happening?
The styles of the regularly loaded child component get processed as usual: ending up in the head.
The styles of the child component loaded as customElement get ignored by the host component.
There is a workaround added manually mutating the styles
prop of the host element. (See main.js) However, this poses multiple problems:
- TypeScript users will run into issues, as the
styles
prop is not included in the type definitions - Child component styles manually need to be gathered up and pushed into the styles of the host element
- this is error-prone
- also degrades developer experience
saas786 and lzurbriggenS0c5
Metadata
Metadata
Assignees
Labels
No labels