-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Vite causes FOUC #8717
Comments
This seems to be a vite issue. (FOUC) |
I think it's the problem of Vite not loading styles at startup. Seems like I'm not the only one with this issue: https://stop.voring.me/notes/90itqps1g3 |
g
briefly?
I have asked the question on the Vite Discord but received no response.
|
いつの間にかVite 3のalphaが出ておる… |
もしかしたら、Viteのバージョンを2.9.9などに上げれば直るかもしれない |
FYI: 現在はv3.0.0-alpha.2が出てます |
I switched my instance to build with Vite 3 Alpha 4 (with the Alpha 3 Vue plugin) and sadly it didn't fix the issue. |
Oh. I've had this/a very similar issue with vite. Try disabling HMR (hot module replacement) in the vite json config file. "hmr": false, Although, doing this will cause you to have to restart the server each time you make a change on the server, which shouldn't be a big deal if you are attempting to run in a production deployment, but would get annoying in a development environment. |
This can sometimes be fixed by setting the HMR client port to 443 (as mentioned here: vitejs/vite#4259) but (IIRC) it didn't work for me when I had this issue. |
Just to make sure, do you see |
We are using |
I confirm that updating vite to 2.9.9 and |
Issue出すにしてもminimal reproducible exampleだと再現しない… |
FOUC だから当たり前だけど CSS の読み込みタイミングが遅すぎる ここら辺関連しそう? vitejs/vite#2460 (comment) |
現に preload 指定してる fontawesome の css は一番に読み込まれているので、rollup でビルドした結果を元に必要な必須チャンクを決定して、HTML 生成時に注入することが解決になりそう。
|
手前の読み込みが長すぎて待ってくれてなさそう もしかしてここが原因では misskey/packages/client/src/scripts/theme.ts Lines 13 to 36 in 38e6202
|
@tamaina |
@acid-chicken なるほど、テーマ周りは深く考えずにrequireを置換したのでリファクタの余地がありそう |
直接的原因であるないに関わらずこれは読み込みに大きな問題を引き起こしている |
(良く考えたらせめてPromise.allを使うべきだったわ…) |
仮説: CSSは読み込まれているが、scopeを判別するための[data-hoge]が後から付けられている |
|
css moduleもちゃんとFOUCになっているので違う気がする…?でもcss moduleも同じか?
style.scssというかapp.hoge.css?デッキやユニバーサルUIの骨組みだけは描画されたりしているので確かにそうかも…! |
💡 Summary
This:
2022-05-20.19-16-59.mp4
5c0e98f52c7403d301079099df74fb7f4dbe5da614773a43ce89bb5feb66aaef0bc6a5a75a243a8855c8717d7ca2e7f126ba72ed5b591919608ffd4373cd77f2.mp4
📝 Steps to Reproduce
This seems to be a problem with Vite, as this didn't happen before Vite.
📌 Environment
Misskey version: Latest git (12.110.1)
Your OS: Linux, Android
Your browser: Firefox, Chrome
The text was updated successfully, but these errors were encountered: