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

SSR/NUXT 3 - Styles get removed #1

Open
I-NOZex opened this issue Dec 19, 2023 · 11 comments
Open

SSR/NUXT 3 - Styles get removed #1

I-NOZex opened this issue Dec 19, 2023 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@I-NOZex
Copy link

I-NOZex commented Dec 19, 2023

With a NUXT SSR app, only the first component registering a style gets to keep it. For some reason, the second component has its styles removed.

Reproduction: https://stackblitz.com/edit/nuxt-3-vite-stylex-x1dwmq?file=components%2Fbtn1.vue,components%2Fbtn2.vue,app.vue
you can notice that the second button shows the red border after loading but quickly loses all styles.

Very likely to be related with the rehydratation

@nonzzz
Copy link
Owner

nonzzz commented Dec 19, 2023

Thanks for you feedback i know why reason cause it :) I will fix it as soon as possbile.

@I-NOZex
Copy link
Author

I-NOZex commented Dec 19, 2023

Perfect, thanks for your work good sir!

@nonzzz
Copy link
Owner

nonzzz commented Dec 20, 2023

@I-NOZex I release a new version try it.

@I-NOZex
Copy link
Author

I-NOZex commented Dec 20, 2023

@nonzzz
Copy link
Owner

nonzzz commented Dec 20, 2023

image
It seems to work fine. I think you should try clearing the cache.

@I-NOZex
Copy link
Author

I-NOZex commented Dec 20, 2023

I'm sorry but it doesn't. Tried in Firefox and Edge, in private tabs... Even in a new fork:
https://stackblitz.com/edit/nuxt-3-vite-stylex-yfqbxt?file=nuxt.config.ts,app.vue
imagem

now the styles of the first button are the ones being removed

@nonzzz nonzzz added the help wanted Extra attention is needed label Dec 20, 2023
@nonzzz
Copy link
Owner

nonzzz commented Dec 21, 2023

@I-NOZex an off topic, I think it's a bug for vite or vue. When i try to using https://github.com/bluwy/create-vite-extra to create a vue ssr template for vite. I try to remove style block the page will panic or get a white screen.(I don't using stylex).

@nonzzz nonzzz mentioned this issue Jan 7, 2024
4 tasks
@nonzzz
Copy link
Owner

nonzzz commented Jan 7, 2024

@I-NOZex a friendly ping, I create a new release v0.2.1 to solve this problem.

@nonzzz
Copy link
Owner

nonzzz commented Jan 7, 2024

@I-NOZex
Copy link
Author

I-NOZex commented Jan 23, 2024

Thank you for the heads-up👍
Unfortunately, it doesn't work, now when the project run fails with


[15:48:00]  ERROR  Pre-transform error: Failed to resolve import "./../../../../../virtual:nuxt:/home/projects/nuxt-3-vite-stylex-kpvjqo/.nuxt/app-component" from "node_modules/nuxt/dist/app/components/nuxt-root.vue". Does the file exist?

@nonzzz
Copy link
Owner

nonzzz commented Jan 24, 2024

@I-NOZex , I create v0.2.5 in past i ignored that vue compiler will contain filename, if the input includes stylex or etc will trigger the next step it's broken.This patch version switch to es-module-lexer only scan import decl i think this logic can convert all of scenses. Can you have a try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants