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.

[Bug] scss with Qwik starter and ssr is broken

See original GitHub issue

Qwik Version

v0.0.34

Operating System (or Browser)

macOs + Chrome

Node Version (if applicable)

No response

Which component is affected?

Qwik Rollup / Vite plugin

Expected Behaviour

scss styles loaded correctly

Actual Behaviour

  1. npm init qwik@latest
  2. Choose Starter, Express and add Prettier
  3. cd qwik-app
  4. npm install
  5. npm install sass <-- UPDATE
  6. add .mytitle { color: red; } inside global.css
  7. add mytitle class to h1 selector inside app.tsx
  8. rename global.css to global.scss
  9. fix global.css import inside root.tsx
  10. run npm run dev.ssr and mytitle class is not loaded

Additional Information

With npm run dev is working correctly

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
manucorporatcommented, Jul 14, 2022

It’s also a vite thing, but when using useStyle$() it’s good to import css or scss using ?inline like this:

import styles from '../../global.scss?inline';

export const App = component$(() => {
	useStyles$(styles);
        ....
})

Otherwise vite will generate global styles, and extra .css files, in effect loading the css twice. Not very happy with this… but i cant find a better way in Vite yet

2reactions
nnelgxorzcommented, Jul 12, 2022

I don’t think it’s the right way. It’s not the wrong way either. Loading from the root.tsx should work, so I’m pretty sure this bug or something that should be documented if it’s not.

But at least we found a work-around so you can keep working. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why We're Breaking Up with CSS-in-JS - DEV Community ‍ ‍
Runtime CSS-in-JS libraries work by inserting new style rules when components render, and this is bad for performance on a fundamental level. 2 ......
Read more >
Qwik Context in Layout Bug #1648 - StackBlitz
json-server simple starter.
Read more >
Troubleshooting Common Errors - Gatsby
If you encounter a webpack error that says Generating SSR bundle failed after installing a plugin and trying to run gatsby develop or...
Read more >
koa-web-kit: Versions | Openbase
Fix HMR broken(#22 ) and build error; ✂️Remove babelrc , only keep babel.config.js ... Add npm run dev:ssr script to quickly start SSR...
Read more >
Optimize Largest Contentful Paint - web.dev
It's rare that a quick fix to a single part of a page will result in a ... Every single page can have...
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