Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As of version 2.2, Deno supports the requisite
compilerOptions
keys to enable React Router typegen types to work in Deno, so I think it's time for a Deno template! There are still a few rough edges here, but I think they're fairly low-hanging fruit to fix in the core RR codebase to make React Router an excellent choice for Deno applications. Here's what still needs work:The requested module 'react-dom/server' does not provide an export named 'renderToPipeableStream'
react-dom/server
has export shims for "node" and "edge" platforms, butrenderToPipeableStream
is only exported for the "node" shims.To make this work, I'm currently manually patching theEdit: I've replaced the separatereact-dom/server
import usingsed
to change it toreact-dom/server.node
as part of the build task pipeline."patch-build"
task in favor of a Viteresolve.alias
entry.Failed resolving binary export. '/Users/orion/Developer/Templates/react-router-templates/deno/node_modules/.deno/[email protected]/node_modules/react-router/package.json' did not have a bin property
deno run -A npm:react-router typegen
), you currently get this error. To work around this, I'm running the React Router binary using its absolute path (deno run -A ./node_modules/.bin/react-router typegen
).await import("../build/server/index.js")
tocreateDenoRequestHandler
without the production build crashing. I tried passingvirtual:react-router/server-build
to it and that didn't work (the file runs outside of Vite). I tried passing aServerBuild
object with agetLoadContext
, I tried passing the promise without awaiting it, I tried passing the promise wrapped in a function. Nothing worked, so this means no Load Context example for Deno (not sure how much this matters with middleware coming soon, which I haven't tried to make work in Deno yet).Could not find package.json in react-router-templates/deno or any of its parent directories
package.json
file is unnecessary for this Deno setup, however without one when trying to runreact-router dev
it crashes.Could not determine server runtime. Please install @react-router/node, or provide a custom entry.server.tsx/jsx file in your app directory.
package.json
without specifying dependencies (since all dependencies are specified indeno.jsonc
), you get this error.adding isbot@5 to your package.json, you should commit this change
@react-router/node
dependency inpackage.json
, then you get the this warning andreact-router dev
uses npm to installisbot
, which has already been installed by Deno.package.json
file with the necessary package specifications to getreact-router dev
working without complaining, but it would be ideal to not need apackage.json
at all.build.target
key invite.config.ts
needs to be set to"ESNext"
to silence errors about top-level await.resolve.alias
key invite.config.ts
needs to be manually set, because there is notsconfig.json
forvite-tsconfig-paths
to operate on.