Closed
Description
Summary
When running @react-router/dev
in Deno without a package.json
file (which is unnecessary, as Deno uses its own deno.json(c)
configuration format), it throws an error because it cannot find the package.json
file to verify that @react-router/node
and isbot
are installed. These packages only need to be installed when the developer has not supplied a custom entry.server.(j|t)sx
file.
As it see it, there are two possible solutions, and they could be implemented incrementally as well:
- Do not validate the existence of a
package.json
file when the developer has supplied a customentry.server.(j|t)sx
file. This will allow the developer to use a custom server entry file with Deno to skip thepackage.json
check. - Validate the existence of
deno.json(c)
if neither apackage.json
nor a customentry.server.(j|t)sx
file were found. Because of Deno's excellent Node compatibility support,@react-router/node
is fully compatible with Deno (if you revert to using apackage.json
file with Deno today). There is likely some sort of performance deficit between a pure-Deno customentry.server.(j|t)sx
file and using@react-router/node
through the compatibility layer, but I'm not sure how dramatic it would be. It's probably smart to encourage developers to use a customentry.server.(j|t)sx
file with Deno by making that the default in the template (it is today), but I think it's worth considering validating@react-router/node
indeno.json(c)
for developers who want to get up and running easily with as little configuration or complexity as possible and aren't concerned about the possible performance differences.
I'm using React Router as a…
framework
Reproduction
Delete the package.json
file from this template and run deno task dev
: https://github.com/remix-run/react-router-templates/tree/main/deno
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M4
Memory: 111.78 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.16.0 - ~/.volta/tools/image/node/22.16.0/bin/node
npm: 10.9.2 - ~/.volta/tools/image/node/22.16.0/bin/npm
pnpm: 10.11.0 - ~/.volta/bin/pnpm
bun: 1.2.15 - /opt/homebrew/bin/bun
Browsers:
Chrome: 137.0.7151.68
Safari: 18.5
Used Package Manager
npm
Expected Behavior
- React Router should work in Deno environments without requiring a package.json file.
- Since Deno does not use package.json for dependency resolution, the code path that tries to load or reference package.json should be skipped when running under Deno (or replaced by a Deno-friendly entry point).
Actual Behavior
- Any calls to the
react-router
binary fail if nopackage.json
is found. - Users are forced to add an inert
package.json
with a comment field merely to satisfy@react-router/dev
's import logic, which doesn’t make sense for Deno.