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
is what's used by the other mainstream fullstack frameworks (e.g. nuxt/nitro, astro, qwik, etc...),
is what Cloudflare recommends,
and would produce the extra benefit of leaving the bundling up to Remix (/vite) which could then preserve dynamic imports and as a result significantly speed up request handling times.
Since the [[path]].ts file is part of the user facing API this would require user facing changes, as discussed a while back (internal discord thread) a solution could be to introduce a cloudflare.ts/_worker.ts/etc... file that would be at the root of a Remix project and have such file renamed and moved in the appropriate _worker.js directory in the buildEnd hook.
Optionally a getServerBuild (or similar) utility (or even a path rewrite on the fly) could be introduced to hide from users the fact that relative import path to the Remix build pre file movement does not actually point to a real file
The text was updated successfully, but these errors were encountered:
The server build for CF doesn't really depend on the /functions directory, since you control that file you could remove it, import the build/server/index.js file from inside a _worker.js file and use CF Pages in Advanced Mode.
The server build you import is just an object conforming to the Remix's ServerBuild interface that's the same regardless if you use CF, Node, Bun or Deno. The createPagesFunctionHandler is the one handling the request to Remix and the response from Remix to CF, but you could also skip that function and go directly to createRequestHandler from the @remix-run/cloudflare package, this one is specific for the workerd runtime and not for CF Pages so it works also for CF Workers.
the remix team has agreed on Remix to output to build/client and build/server and then have the
Cloudflare build logic do anything it wants and move those around into build/cloudflare-pages
(or whatever the name ends up being) with the buildEnd hook of the remix() plugin
When producing deployment/production builds that target Cloudflare, such builds rely on the
/functions
directory, for example see:templates/cloudflare/functions/[[path]].ts
createPagesFunctionHandler
Instead of this, builds should use advanced mode and produce an
_worker.js
directory instead (basic example of the_worker.js
directory).This
Since the
[[path]].ts
file is part of the user facing API this would require user facing changes, as discussed a while back (internal discord thread) a solution could be to introduce acloudflare.ts
/_worker.ts
/etc... file that would be at the root of a Remix project and have such file renamed and moved in the appropriate_worker.js
directory in thebuildEnd
hook.Optionally a
getServerBuild
(or similar) utility (or even a path rewrite on the fly) could be introduced to hide from users the fact that relative import path to the Remix build pre file movement does not actually point to a real fileThe text was updated successfully, but these errors were encountered: