Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite: cloudflare preset load context #8649

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

pcattori
Copy link
Contributor

@pcattori pcattori commented Jan 31, 2024

Closes: #

  • Docs
  • Tests

Testing Strategy:

Copy link

changeset-bot bot commented Jan 31, 2024

🦋 Changeset detected

Latest commit: 1917bc3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@remix-run/dev Patch
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/node Patch
@remix-run/react Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch
@remix-run/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

since we dropped the term "adapter" in favor of "preset" its needs
less clarification
@pcattori pcattori merged commit 45e28ed into release-next Jan 31, 2024
9 checks passed
@pcattori pcattori deleted the pedro/release-cloudflare-preset-load-context branch January 31, 2024 20:47
Copy link
Contributor

🤖 Hello there,

We just published version 2.6.0-pre.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

github-actions bot commented Feb 1, 2024

🤖 Hello there,

We just published version 2.6.0-pre.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@kiliman
Copy link
Collaborator

kiliman commented Feb 1, 2024

@pcattori Is setRemixDevLoadContext considered a public API?

I'm using a custom Express server, so it would be nice if I could set the load context in the Vite dev server as well.

@pcattori
Copy link
Contributor Author

pcattori commented Feb 1, 2024

@kiliman : no, its not considerd public API.

The idea is that for Node-based custom servers, you can use the same server for both dev and prod where you can choose to delegate asset handling and route handling to Vite in dev. In that world, you already have direct access to createRequestHandler where you can do whatever you'd like with loadContext. And the best part is that your load context is automatically consistent in dev and prod.

The issue with CF is that (as of today) Vite can't delegate server code execution to other runtimes (like workerd) so you can't run the same server for dev and prod (yet). So setRemixDevLoadContext is a temporary stopgap for CF to approach parity with Node-based custom servers.

@kiliman
Copy link
Collaborator

kiliman commented Feb 1, 2024

True. Thanks!

Copy link
Contributor

github-actions bot commented Feb 1, 2024

🤖 Hello there,

We just published version 2.6.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants