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

flash of unstyled content with css styles inside a SFC #229

Closed
n4an opened this issue Oct 13, 2021 · 11 comments
Closed

flash of unstyled content with css styles inside a SFC #229

n4an opened this issue Oct 13, 2021 · 11 comments
Labels
bridge bug Something isn't working nitro

Comments

@n4an
Copy link

n4an commented Oct 13, 2021

I put styles for each component inside it (SFC), and with nuxt-edge+ nuxt/bridge when refresh page it is shown without styles and after second it is applied.
Was ok prior

@n4an
Copy link
Author

n4an commented Oct 13, 2021

or may be this is applied too late

css: ['~/static/css/styles.css'],

@danielroe danielroe transferred this issue from nuxt/nuxt Oct 13, 2021
@danielroe
Copy link
Member

@Mitch-i Would you provide a reproduction, please - and the other info we ask for in a new issue template on this repo? (I know you filed it elsewhere originally!)

@danielroe danielroe added bridge bug Something isn't working needs reproduction labels Oct 13, 2021
@danielroe danielroe changed the title nuxt-edge+ nuxt/bridge and css styles flash of unstyled content with css styles inside a SFC Oct 13, 2021
@antfu
Copy link
Member

antfu commented Oct 13, 2021

If you are using vite mode, keep track on nuxt/vite#211

@nathanchase
Copy link

I've been seeing the same (FOUC) when using the css property of nuxt.config.js when using nuxt-edge+ nuxt/bridge.

@atinux
Copy link
Member

atinux commented Nov 8, 2021

Is this still an issue?

@morinokami
Copy link

Hi, I have a similar problem (though I'm not using Nuxt Bridge).

When I'm using components from pages inside app.vue, they don't have styles on the first load. Here's the repository I created for reproduction:

https://github.com/morinokami/nuxt3-fouc-repro

And here's a screenshot demonstrating the problem (the word "test" at the upper left doesn't have styles on the first view, but the NuxtWelcome component does):

Screenshot from 2021-11-28 11-10-46

My environment:

  • Operating System: Linux
  • Node Version: v16.13.0
  • Nuxt Version: 3.0.0-27296423.f3082ca
  • Package Manager: [email protected]
  • Bundler: Vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

@xxSkyy
Copy link

xxSkyy commented Jan 1, 2022

Hi, I have a similar problem (though I'm not using Nuxt Bridge).

When I'm using components from pages inside app.vue, they don't have styles on the first load. Here's the repository I created for reproduction:

https://github.com/morinokami/nuxt3-fouc-repro

And here's a screenshot demonstrating the problem (the word "test" at the upper left doesn't have styles on the first view, but the NuxtWelcome component does):

Screenshot from 2021-11-28 11-10-46

My environment:

* Operating System: `Linux`

* Node Version:     `v16.13.0`

* Nuxt Version:     `3.0.0-27296423.f3082ca`

* Package Manager:  `[email protected]`

* Bundler:          `Vite`

* User Config:      `-`

* Runtime Modules:  `-`

* Build Modules:    `-`

I've had this problem in nuxt3, upgraded to latest nuxt3 version and it disappeared, give it a try

@xxSkyy
Copy link

xxSkyy commented Jan 2, 2022

I've also noticed it while updating one of my projects from nuxt2 to nuxt-bridge.

I've investigated it a bit more and it seems like only part of css are passed from SSR, and other aren't just there.

I've made also quick repro here and live demo

Just refresh and see unloaded classes for split second at the center.
Also background and some class got compiled if you'll check page source

@CarsonBain
Copy link

CarsonBain commented Apr 8, 2022

+1 for this. Upgraded a nuxt 2 project to bridge and seeing a flash of unstyled content in dev and also after using build and start to serve the production build.

Here's a quick code sandbox. On the sandbox it appears that the error only happens every few refreshes, but on my project (maybe due to more css), it's happening every refresh: https://codesandbox.io/s/nameless-http-vcxw98?file=/package.json. Can't seem to figure out how to get codesandbox to allow me to run the project in production mode, but hopefully this is enough information! Let me know if I can provide anything else.

Flash of unstyled content - Watch Video

@n4an
Copy link
Author

n4an commented Apr 11, 2022

i some how resolved the problem, I not remember how, may be with

  // build: {
  //   optimization: {
  //     runtimeChunk: true,
  //     splitChunks: {
  //       maxSize: 240000,
  //       name: true,
  //       cacheGroups: {
  //         styles: {
  //           name: 'styles',
  //           test: /\.(css|vue)$/,
  //           chunks: 'all',
  //           enforce: true
  //         }
  //       }
  //     }
  //   }
  // },

@danielroe
Copy link
Member

Let's follow in #26.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2022
@danielroe danielroe transferred this issue from nuxt/framework Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge bug Something isn't working nitro
Projects
None yet
Development

No branches or pull requests

8 participants