Thread Reader

Colocating client/server code in a single file is the next battleground for better DX between meta frameworks. Let's zoom into what it is! 🧵🪡🧶

Module extraction is the way it is done today. 1) Well-known top-level function invoked by the server but tree-shaken by the bundler for the client. 2) Some form of manual type safety. (no special code transformation needed)
Function Extraction requires code transformation, which can extract inlined functions into top-level exports (module extraction) Advantage: - A lot more natural DX - Automatic type safety - Any number of functions (not just well-known exports)
Closure Extraction (similar to function extraction, but) can also capture closure variables. 🤯 Advantages: - Even better DX, as closures are the bread-and-butter of modern frameworks. - Can pass JSON data, Date, Promise, cyclic graphs, closures
Miško Hevery (
CTO at @builderio, creator of @QwikDev, @angular, @angularjs, co-creator of #karmajs
Follow on Twitter
Missing some tweets in this thread? Or failed to load images or videos? You can try to .