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

[NextJS] global.css is required in for Stylex to function. #268

Closed
madebyjonny opened this issue Dec 27, 2023 · 4 comments
Closed

[NextJS] global.css is required in for Stylex to function. #268

madebyjonny opened this issue Dec 27, 2023 · 4 comments
Labels
enhancement New feature or request question Further information is requested wontfix This will not be worked on

Comments

@madebyjonny
Copy link

madebyjonny commented Dec 27, 2023

The problem
I noticed when starting from a blank NextJS (v14) project that styleX stops working when the global.css file is removed from the root layout file. The classes generated by styleX are applied to the relevant elements but no styles are applied.

How to reproduce

Steps to reproduce:

  1. Create a new NextJS project.
  2. Removed the boilerplate files, keep layout & page files.
  3. Follow the instructions from the StyleX docs for NextJS to config it.
  4. Remove the global.css import from the layout file.
  5. Should see an unstyled page and that the StyleX styles have no effect

Expected behavior
I would have expected StyleX to work without the global.css file.

Environment (include versions). Did this work in previous versions?
NodeJS v20.5.1 (this is the only version I have tried).
NextJS 14.0.1 (this is the only version I have tried).

@madebyjonny madebyjonny changed the title global.css is required in NextJS for Stylex to function. [NextJS] global.css is required in for Stylex to function. Dec 27, 2023
@nmn
Copy link
Contributor

nmn commented Dec 28, 2023

This is a known issue and something we can't fix in the near term. I've reached out to folks from the NextJS team for help and hope to improve the situation early next year.

@nmn nmn added enhancement New feature or request question Further information is requested wontfix This will not be worked on labels Dec 28, 2023
@madebyjonny
Copy link
Author

Thanks @nmn, could it be worth mentioning this in the docs in the meantime ?

@nmn
Copy link
Contributor

nmn commented Dec 28, 2023

I'll have a fix ready very soon!

@nmn
Copy link
Contributor

nmn commented Dec 29, 2023

Duplicate of #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants