You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously we were able to inline server functions directly in components. Since v1.1.0 this is no longer possible and throws a very verbose error (including the full component three times).
Expected behavior 🤔
I'm wondering if this change is deliberate or a bug. If it is deliberate, maybe the error message can be improved.
Hi, @peterhirn
yes, that's an unpredicted regression. It's on me and I'm really sorry about that.
The new server-function plugin has much more aggressive treeshaking, this prevents code from leaking to the frontend. Unfortunately, as a consequence of that, it does not perform closure extraction.
As a workaround, you can refactor your code like such:
And that would work again, plus, even in the old plugin - that would make your code safer, imho, by making it easier for the code-removal preventing it to land in the client-side bundle.
I'm still working on a better DX, either to migrate or to add code-extraction to the plugin.
Duplicates
Latest version
Current behavior 😯
Previously we were able to inline server functions directly in components. Since v1.1.0 this is no longer possible and throws a very verbose error (including the full component three times).
Expected behavior 🤔
I'm wondering if this change is deliberate or a bug. If it is deliberate, maybe the error message can be improved.
Steps to reproduce 🕹
pnpm build
Context 🔦
No response
Your environment 🌎
The text was updated successfully, but these errors were encountered: