Unify server runtime packages via Node.js conditional exports #2979
tylerbrostrom
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Release 1.4.0 got rid of magic imports (thank goodness!)
Instead of importing server-side helpers like
json
fromremix
, you now import them from one of the following:@remix/deno
@remix/cloudflare
@remix/node
These packages either re-export or re-implement stuff from the
@remix/server-runtime
package.Point is, they’re mostly the same API surface…
Assertion
APIs common to these packages (i.e. stuff from
@remix/server-runtime
) should be consolidated and implemented in a single package.Platform-specific APIs would remain in their respective packages (e.g.
createCloudflareKVSessionStorage
stays in@remix/cloudflare
).Why?
import {...} from '@remix/cloudflare'
vsimport {...} from '@remix/node'
is not my concern.esbuild
).esbuild
understands conditional exports and can be configured to understand non-standard conditions (e.g.cloudflare-workers
). That bundling logic would be a cinch to implement, using the the config optionserverBuildTarget
.fetch
landing in Node.js. The need for separate implementations may eventually dissipate, leading to duplicate implementations across packages. Deno and Cloudflare implementations are already very similar if not identical.Beta Was this translation helpful? Give feedback.
All reactions