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
code splitting messes up the snapshots #33
Comments
As far as I understand it there is core incompatibility with style-loader - blobs will not work. You need to create blob object first in JS and only after this you can use it |
An easy workaround, that puts the styles inline, is to add |
Not sure I understand the issue. Why it uses blob in production build and not generates css files? |
because you usually want sourcemaps even in production builds to be able to debug then. You can't have sourcemaps AND inline. |
But how react-snap relates to sourcemaps? It runs production build js and saves html - unless you have error it should not touch sourcemaps. As far as I know sourcemaps inserted this way:
so I can not see how this relates to blobs
I do not understand the issue |
If code-splitting and sourcemaps are "on", when a browser (headless chrome for ex) renders the page, These are complete URLs with the hostname (localhost when rendered for react-snap) which is a problem for react-snap's purpose. I'll check what genuine SSR does. The solution probably lies there. |
So it has nothing to do to sourcemaps. What you described is some kind of css-in-js solution. Right? css-in-js means that you have those beats in JS. Is it true? My approach here is to remove css-in-js artifacts from final snapshot (you have copy in JS bundle anyway). There is an option to remove styleTags from final snapshots, we can do same for |
Yes it does ;) If you have code-splitting AND sourcemaps, then you see this "blob" behavior. No, I don't have css-in-js but when code-splitting is activated, webpack does a lot of weird things when creating the different chunks. Thank for the tip. I'll try that. |
I'm afraid I won't be able to help you more without example |
@stereobooster You've done a lot. I'll get back to you after following some of your leads. |
Short explanation/solution if anyone ends up here with the same problem: For now, until webpack creates css chunks – new css workflow, you can either turn |
I tried react-snap on a code-splitted create-react-app project (using
react-loadable
but that's not the issue). Once deployed, the browser started to complain as it didn't know what to do withThe explanation is just above style-loader#useable : If sourcemaps are not turned off (which gaearon usually advices against style-loader fetches the splitted styles this way.
The text was updated successfully, but these errors were encountered: