stylex icon indicating copy to clipboard operation
stylex copied to clipboard

esbuild plugin

Open mohamedmansour opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. I use esbuild to build my web apps, and need stylex to generate the css for me.

Describe a solution you'd like esbuild plugin

Describe alternatives you've considered Reverting to webpack again which I don't want.

mohamedmansour avatar Dec 07 '23 06:12 mohamedmansour

The work to create a Vite plugin is underway. We can tackle this after that is done.

nmn avatar Dec 07 '23 10:12 nmn

The work to create a Vite plugin is underway. We can tackle this after that is done.

Thank you! Will that by any chance include Module support instead of CommonJS?

mohamedmansour avatar Dec 07 '23 15:12 mohamedmansour

We have a POC for a Vite plugin that works with Qwik. Qwik relies on SSR in a way that is similar to Next App dir, so Making Qwik would imply that it should work with most Vite apps.

https://github.com/nmn/qwik-stylex

I will be porting this to a few additional Vite frameworks to verify that it works as expected.

@mohamedmansour We will use the cannonical module system for the bundler in question. When in doubt we compile to CJS because Node let's you import CJS from ESM but not vice versa.

nmn avatar Dec 09 '23 13:12 nmn

I have written the plugin through unplugin to support: rspack, esbuild and vite. The repo is here.

But there is in a primitive stage, and there are still many things to complete.

Any questions DM me, or commit an issue in the repo.

Thanks~

eryue0220 avatar Jan 05 '24 14:01 eryue0220

An Esbuild plugin is available as 0.5.0-alpha.2 please see if it works for your use-cases.

nmn avatar Jan 10 '24 20:01 nmn

Fixed in #319

nmn avatar Jan 10 '24 20:01 nmn