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
importIndexPagefrom"#components/IndexPage.jsx";exportdefault{get(){// statically (TS), this needs to resolve to the correct component for live-bindings between server and client// in runtime (JS), this needs to resolve to `view("IndexPage", props);`returnIndexPage({posts: [{id: 0,title: "Hello, world!"}]});},};
Other uses also possible, like importing stores from anywhere, provided we can make sure that operations are still transactionalised.
With export conditions, we should even make it possible to import stores from clientside components, translating the implementation to a fetch call to some canonical API route that accesses the database and returns the results. But this could quickly become a security nightmare unless done conservatively and in an extremely guarded way (only reads, and possibly hardcoding the queries on the server so it doesn't become a universal mechanism to access the database).
Considerations:
Needs to work both clientside (esbuild) and serverside (node/bun/deno); esbuild currently bundles from ., not from ./build, for hotreloading during dev
TS should be supported to the extent possible
It should be compatible with both dev (build&serve) and prod (build now, serve later) environments
Is currently only possible with Node, as introducing custom loaders isn't supported in Bun (oven-sh/bun#13415) or Deno (denoland/deno#23201). We can only mainline this once Bun and Deno support it.
Global bare imports.
(Relates to #122)
Other uses also possible, like importing stores from anywhere, provided we can make sure that operations are still transactionalised.
With export conditions, we should even make it possible to import stores from clientside components, translating the implementation to a fetch call to some canonical API route that accesses the database and returns the results. But this could quickly become a security nightmare unless done conservatively and in an extremely guarded way (only reads, and possibly hardcoding the queries on the server so it doesn't become a universal mechanism to access the database).
Considerations:
Is currently only possible with Node, as introducing custom loaders isn't supported in Bun (oven-sh/bun#13415) or Deno (denoland/deno#23201). We can only mainline this once Bun and Deno support it.
The text was updated successfully, but these errors were encountered: