question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS is included in SSR builds

See original GitHub issue

Describe the bug

CSS is included in SSR builds, which is unexpected: CSS is useless on the server-side. (You can actually see that the CSS included in the SSR build is unused.)

Reproduction

https://github.com/brillout/vite-bug-css-included-in-ssr-build

System Info

System:
    OS: Linux 5.10 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (2) x64 Intel(R) Celeron(R) N4020 CPU @ 1.10GHz
    Memory: 413.73 MB / 2.71 GB
    Container: Yes
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 18.0.0 - ~/.config/nvm/versions/node/v18.0.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.6.0 - ~/.config/nvm/versions/node/v18.0.0/bin/npm
  Browsers:
    Firefox: 97.0.1

Used Package Manager

pnpm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
patak-devcommented, Jun 30, 2022

@sapphi-red I tagged you in a thread in discord started by @bluwy, that also found memory issues possibly related to #8278. I think we should revert v2, yes, PR welcome if you can.

And for v3, I don’t know about the implications of forcing minification. Maybe we should revert it too and then test with more time for v3.1

Also, I wonder if we could bail out of CSS a lot sooner in SSR so we don’t need to process them (in the same lines of https://github.com/vitejs/vite/pull/8454)

0reactions
sapphi-redcommented, Jul 3, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding CSS to React SSR Components - Stack Overflow
I am trying to add CSS to my component built in React using SSR, but I am unable to do so. Things I've...
Read more >
Adding style to Server-Side rendering and automating the ...
Adding style to Server-Side rendering and automating the build process ... Creating a project for SSR from scratch (including writing babel ...
Read more >
React Server Side Rendering (SSR) with Express and CSS ...
I was learning React Server Side Rendering (SSR) recently. Lots of tutorials have so many new libraries and have a large codebase.
Read more >
Styles & CSS - Astro Documentation
Learn how to style components in Astro with scoped styles, external CSS, and tooling like ... Styles won't be automatically included in the...
Read more >
JavaScript-less Static SSR using Styled Components
How to build a completely static site using React and Styled Components. ... How do we extract the styles into a CSS file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found