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

Fix styles to be sorted on static-entry.js #13482

Conversation

originerd
Copy link

Description

There was a problem when a user tries to refresh without cache. In this case, style tags in HTML are messed up. To solve it, I added some code to sort style files by name.

  • FYI (without this PR)
    1. Refresh without cache
      스크린샷 2019-04-19 오후 3 59 15

    2. Refresh with cache
      image

Related Issues

@originerd originerd requested a review from a team as a code owner April 19, 2019 07:03
@originerd originerd force-pushed the fix-styles-to-be-sorted-on-static-entry branch from 0f54b5c to c66c4de Compare April 19, 2019 07:11
@pieh
Copy link
Contributor

pieh commented Apr 19, 2019

@originerd we are creating single css file since #11800 / gatsby@2.1.3, so this should not happen (unless you modify webpack config).

There is also a lot more nuance to this problem in general than just sorting by chunk index - see #8092 to see more complete implementation of fixes for the problem. This is pretty hard problem to solve, because this might fix initial css "ordering" but as you navigate and webpack runtime inject more chunks - it will always append them to "end" so they will end up in random position in tag

@sidharthachatterjee
Copy link
Contributor

@originerd Thank you for attempting to fix this!

As @pieh mentioned the issue is a little more nuanced (and shouldn't be relevant after #11800) so we're closing this out for the moment.

Please know that we really appreciate your work on this nonetheless and we're looking forward to having you as a contributor! 💪 💜

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 this pull request may close these issues.

3 participants