facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.22k stars 303 forks source link

I would like to support dev-runtime for Next14 #470

Closed watanabeyu closed 4 months ago

watanabeyu commented 4 months ago

Describe the feature request

In Next14, even when setting runtimeInjection to true in .babelrc, the CSS does not update during development. I believe StyleX is an excellent zero-runtime CSS library, so I really hope there can be some solution for support in Next14. I understand the issue with the swc compiler, but I would like to use it for development.

nmn commented 4 months ago

If you're using the app directory with Next 14 you're using Server Components. Server Components are not compatible with any runtime injection of styles.

dev-runtime will never be supported with Next 14. In fact dev-runtime isn't meant for development at all. It only exists for quick prototyping before setting up a proper build setup.

We have an example Next 14 app in the repo and another starter project linked on the Ecosystem page.

We know that the hot-reloading with Next is sub-par and we're working on a CLI (#412) to solve this problem.