-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby): create a single CSS file to avoid code-splitting issues #11800
Conversation
…by split CSS files loading in different orders Fixes #11072
Might be nice to add a link to the webpack docs in code. Would be handy to have a nice way to turn it on and off because I think css codesplitting doesn't break when cssmodules is used so if we could like add it as a option to our loaders that would be awesome. Maybe not worth the extra code. Code looks 👍 |
Things can still break with CSS Modules (that's what Twitter uses and they still had a lot of trouble) but yeah, it'd be harder. We could definitely document how to re-enable CSS splitting — let's see if anyone asks for it first though. |
Publishing! |
I use CSS modules and it’s definitely still been an issue—so much so that I’ve not been using gatsby-link as a workaround. Really excited to try this. |
oh yeah specificity of course 🤦♂️. Yeah it can still break |
@KyleAMathews This didn't fix the issue for me. Still think what I mentioned @ #8092 (comment) is right—it's the preloading & injecting CSS onto the page that's the issue. Also think pre-loading CSS, if not code-splitting it, would be extraneous (and possibly continue breaking sites in the same way when hovering gatsby-links). I can privately share a link where I've deployed a site updated to the latest version, and can 100% repro the issue. |
Yes please share your code — not sure what CSS would be preloaded anymore? The point of this PR was that we're not code-splitting CSS anymore. |
https://www.classchirp.com/blog There's a link near the top that's prefixed with 'hover me', and text right above it that will increase with size.
Here's the network tab showing CSS being preloaded on that hover: |
Do you have a lock file? Doesn't seem like you've upgraded. |
I’m on mobile until early tomorrow and seemingly can’t view it on GitHub because the diff is too large. Will update then. |
@KyleAMathews From my yarn.lock:
|
It definitely looks like css is split still https://www.classchirp.com/webpack.stats.json. |
Anything else I can provide? |
Can you share your site's code? |
@KyleAMathews I've just added you as a collaborator. Branch is |
Confirmed the bug — both on @dustinhorton's site + on using-css-modules + using-sass. Looks like it's specific to gatsby-plugin-sass as other types of css are being combined correctly. |
This fixes things #11927 |
Fixes #11072