Skip to content
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

ssr build / use client / broken global CSS import from package #452

Closed
Tracked by #423
aheissenberger opened this issue Feb 5, 2024 · 10 comments
Closed
Tracked by #423
Assignees

Comments

@aheissenberger
Copy link
Contributor

aheissenberger commented Feb 5, 2024

Problem:
The imported CSS from a package or normal CSS file is in the production build but not loaded in the browser.

Example:

'use client';
import "@measured/puck/puck.css";

or

'use client';
import "./puck.css";
  • pnpm waku dev 👍 - CSS is loaded
  • pnpm waku dev --with-ssr 👍 - CSS is loaded
  • pnpm waku build --with-ssr 👍
  • pnpm waku start --with-ssr 👎 - imported CSS is missing

No problem, if the import is in a server component above the client component in the tree!

@dai-shi
Copy link
Owner

dai-shi commented Feb 5, 2024

Thanks for reporting!

This is probably hard, and we probably need to mix hoistable elements and vite css bundling. (Or, I'm not sure. 🤔 Why is dev working...

Can you try pnpm waku build and pnpm waku start? Should it fail too?

dai-shi added a commit that referenced this issue Feb 6, 2024
@aheissenberger
Copy link
Contributor Author

Can you try pnpm waku build and pnpm waku start? Should it fail too?
without SSR I get the same result

same result - CSS not loaded in the browser

I checked the files in the dist/public/assets folder (build with and without SSR) - the dist/public/assets/rsc4-6d73ab79e-KsjFJjAL.css does contain the needed CSS.

The CSS is not loaded in the browser.

I would not give this problem a high priority as there is currently a simple fix by loading global CSS in a server component in the tree above the client side component.

@dai-shi
Copy link
Owner

dai-shi commented Feb 6, 2024

I would not give this problem a high priority as there is currently a simple fix by loading global CSS in a server component in the tree above the client side component.

Thanks for the note.

@aheissenberger aheissenberger changed the title ssr build / use client / broken CSS import from package ssr build / use client / broken global CSS import from package Feb 6, 2024
@dai-shi
Copy link
Owner

dai-shi commented Feb 6, 2024

Why is dev working...

Ah, because Vite sends the css module through WebSocket.

I think I'd leave this issue for @Aslemammad.

@Aslemammad
Copy link
Contributor

Could you please assign me?

@Aslemammad
Copy link
Contributor

@aheissenberger #549 should fix this.

@aheissenberger
Copy link
Contributor Author

@aheissenberger #549 should fix this.

@Aslemammad yes this fixed it!

@Aslemammad
Copy link
Contributor

Thank you so much for the update!

@Aslemammad
Copy link
Contributor

#658 fixes this and it will be in v0.20.1!

@dai-shi
Copy link
Owner

dai-shi commented Apr 21, 2024

Closing this as resolved. Let us know if it's not.

@dai-shi dai-shi closed this as completed Apr 21, 2024
@dai-shi dai-shi mentioned this issue Apr 21, 2024
76 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants