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
Group client side only exports in client object and server side only exports in server object.
All exports that will run in both client and server would still be exported like today.
By grouping exports together that only run in one environment, it should be easier to understand what code runs where.
// beforeexportfunctionheaders(){}exportfunctionloader(){// ..}exportfunctionaction(){// ..}exportfunctionclientLoader(){// ..}exportfunctionclientAction(){// ..}// afterexportconstserver={// middlewares: [], -- in the futureheaders(){// ..},loader(){// ..},action(){// ..}}exportconstclient={// middlewares: [], -- in the futureloader(){// ..},action(){// ..}}
Potential issues
Code splitting and bundling: because we group loader and action (client and server), code splitting could be harder to do?
Grouping server only and client only code and keeping all "shared" code (Component, ErrorBoundary, handle, ...) as simple exports could also not make it clearer. Questions like: "but why all of those are not grouped in a shared object?" may happen.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The proposal
Group client side only exports in
client
object and server side only exports inserver
object.All exports that will run in both client and server would still be exported like today.
By grouping exports together that only run in one environment, it should be easier to understand what code runs where.
Potential issues
loader
andaction
(client and server), code splitting could be harder to do?Component
,ErrorBoundary
,handle
, ...) as simple exports could also not make it clearer. Questions like: "but why all of those are not grouped in ashared
object?" may happen.Beta Was this translation helpful? Give feedback.
All reactions