XantreDev / preact-signals

Preact Signals: Supercharge your React/Preact development! Unleash the power of reactive programming with hooks, components, a TanStack query adapter, and more. Code smarter, not harder
https://preact-signals.netlify.app/#/
MIT License
66 stars 1 forks source link

Question: Extracting out the @preact-signals/safe-react/swc plugin into an individual package? #163

Closed Sanderand closed 4 months ago

Sanderand commented 4 months ago

Hey there,

I was trying to set up @preact/signals-react today and had to integrate the useSignals() call in every component using signals. I'm using vite + swc which makes using the babel plugin "module:@preact/signals-react-transform" somewhat useless.

Today, I stumbled upon this project and am now using the @preact-signals/safe-react/swc plugin, which works great. So far so good. I was wondering if there would be a change to extract out the swc plugin into a separate package?

I haven't looked into all the other features @preact-signals/safe-react provides, but I'm generally not too interested and want to keep the setup as simple as possible. using both @preact-signals/safe-react and @preact/signals-react at the same time currently doesn't feel ideal, because it would allow me (and my dev team) to import signal (and other things) from either source - causing unnecessary confusion.

Hope this makes sense. Thanks for the swc plugin so far! <3

XantreDev commented 4 months ago

Hey. safe-react is exactly the same as @preact/signals-react in terms of features. The only difference - it was released earlier than v2 of @preact/signals-react and uses less complex tracking system. There will be less guarantees if it's allowed to use with stock library If you use swc plugin - it means that it uses safe-react under the hood. So nothing should change if you alias '@preact/signals-react' to '@preact-signals/safe-react'. If it will work - you can just ditch off signals-react