-
Notifications
You must be signed in to change notification settings - Fork 648
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
In need of stylex for deno fresh #2181
Comments
Please create an issue on the StyleX repo as well so we can help make this happen. What bundler is Fresh based on? |
I started looking at this (without knowing about this issue) but didn't make a whole bunch of progress last week: https://discord.com/channels/684898665143206084/1189565451664117760/1189681460932788254. For simplicity, the summarized version is:
@nmn, the key issue I see is number 2, in that fresh doesn't currently have a spot to perform some sort of compilation. I started investigating what it would look like if fresh plugins could create "processed" files, and then would use these files instead of the original source files. This all seemed to work just fine, assuming the modified source can be produced (i.e. remove The stumbling block I had was how to integrate with babel easily, although I must admit I didn't spend a large amount of time trying. Fresh has the concept of https://fresh.deno.dev/docs/concepts/ahead-of-time-builds to run esbuild on the islands that get sent to the browser. Ideally there would be an esbuild plugin provided by stylex that fresh could simply use. @marvinhagemeister can speak about the entire picture more intelligently, since he has a more complete view of node/react/babel/etc. (I basically just know about deno/fresh 😅 ) |
The overall issue is the same as in #1622 . The crux of the problem is that we don't compile the server code at the moment. We only transpile the code that is used for islands via esbuild. Adding the necessary babel pass is trivial, but for as long as we don't transpile the server code it wouldn't help much. I've been advocation for adding some sort of loader API to Deno for enabling those workflows over the past months, but it looks like that won't come anytime soon. At least not support for custom loaders. That means the only other option is to transpile everything ourselves with Fresh, but then you run into the problem that |
For context, here's how StyleX is supposed to work:
This approach doesn't seem to fit in with the way Deno works at the moment. Not only do we need to collect styles from both server and client code. We also need to avoid any kind of bundle splitting of the generated CSS. Generated a single small CSS file is a core performance reason to use StyleX. The other problem seems to be the way Deno handles imports. StyleX needs to compile imported packages that may contain StyleX too. It sounds like the only possible solution here is to have a "source" folder that gets compiled wholesale into a "src" folder. This compilation can happen while you author code. The CSS file can be updated in-place with every edit. I'm already looking into this, but even with |
this is a feature/plugin request.
Stylex is a css in js solution that builds css in compile time,
this issue is created so please people with knowledge pave the way to make it happen in fresh.
please provide the way this plugin needs to be implemented.
The text was updated successfully, but these errors were encountered: