New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Style missing when using client:only directive #6931
Comments
Can add that I've the same with Vue. I think it is related with this 7653cf9 |
I can confirm this is an issue with Vue as well. Maybe it has to do with scoped styles? Another thing I noticed, that may be of relevance is that the ordering of styles is different in dev and build. Importing This started roughly around the same time the component styles disappeared when using Edit: in case the style ordering isn’t related to this issue, I have opened a separate one here: #6975 |
I run into the same issue with Vue as well |
Any update on this one? Running Vue and have the same issue |
Same issue here with Vue. It's a really weird edge condition, as it used to work until it didn't. Changing the client directive didn't fix the problem in this case. Multiple nested vue components may also be causing a problem for me, as I'm unclear on how the client directives affect their children. |
same issue with Vue |
1 similar comment
same issue with Vue |
Sorry for the regression. I've looked into the issue and #7218 should fix it. |
Still got this problem with astro 2.10.15 |
Still having the problem with Astro(also with Starlight), Vue and PrimeVue. Edit: for anyone having the same issue, take a look at this template from PrimeVue repository. It works fine. The trick was to import needed styles in the components:
|
Still have the issue with version 4.0.6 .. :/ |
Same here but using Preact |
Getting the same with version 4.2.4 - specifically pertaining to loading in a stylised datatable, it momentarily renders in correctly, only then to have the styles removed completely. |
This issue should probably not be closed. Got the same problem (styles, from an SCSS module, disappear after build but present in dev) with 4.2.5 |
What version of
astro
are you using?2.3.2
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Summary
Given Svelte component with styles used in another Svelte component loaded with the
client:only
directive, styles of the inner component are missing onastro build
.Example
Let’s say we have a component called
Flow
to create vertical rhythm:Additionally, we have a component
Card
that usesFlow
:Let’s say we want to use the
Card
component client-side only. Inindex.astro
, we write:Everything looks fine, but on production the
Flow
style is missing.Distilling the problem
astro dev
astro build && astro preview
client:only
directive is removed, theFlow
styles are applied againclient:only
directive is swapped forclient:loaded
or any of the otherclient:*
directives, styles are applied again<Flow>
component to theindex.astro
, the styles are applied again, regardless whether we keep theclient:only
directive onCard
or notIt appears
astro build
performs an action thatastro dev
doesn’t, which may discard styles or cause classname mismatches.Link to Minimal Reproducible Example
https://stackblitz.com/edit/bug-astro-svelte-styles?file=src/pages/error.astro
Participation
The text was updated successfully, but these errors were encountered: