stylex: It won't work without the CSS file generated by the css-loader
The problem
In Next.js, if you don’t import any .css file, the styles generated by stylex will not be added to the stylesheet.
How to reproduce
Steps to reproduce:
- delete this line https://github.com/facebook/stylex/blob/c9b205750d835cba82b13ef5cdeaf30bbc683f70/apps/nextjs-example/app/layout.tsx#L10
- rebuild
- not working because not exists
.next/static/css
Expected behavior
Is any .css file necessary? Can it be omitted?
Environment (include versions). Did this work in previous versions?
About this issue
- Original URL
- State: open
- Created 7 months ago
- Reactions: 1
- Comments: 15 (15 by maintainers)
Yes. This is a known issue with the Nextjs Plugin. For now, that one CSS file is required. Use it for global styles and resets.
@nmn Okay, yes. I wasn’t thinking about virtual modules, but yeah, you’re right. I will write down how I could do it that way, but mostly I will start on the other tasks.
@nmn
No problem!
Yeah, I’ll see what I can do. Thank you!
@timwehrle Yes. Both of those are currently blocked on changes to the Babel plugin that I will be making. I wrote an RFC about it in Github Discussions
https://github.com/facebook/stylex/discussions/111
Also, didn’t mean to close this task. Reopening.
@nmn
Thank you for the overview. I will get back to you if I need any further help or clarification.
@nmn I can work on this.