Replies: 1 comment
-
Hey @gatesn, this is indeed a misuse of Remix. If you navigate to /foo manually, you'll see an error:
This is because import {
__commonJS,
__toESM,
require_jsx_dev_runtime
} from "/build/_shared/chunk-EETRBLDB.js";
// empty-module:~/test.server
var require_test = __commonJS({
"empty-module:~/test.server"(exports, module) { // <=== PRUNED
module.exports = {};
}
});
// app/routes/foo.tsx
var import_test = __toESM(require_test());
var import_jsx_dev_runtime = __toESM(require_jsx_dev_runtime());
var _unused = (0, import_test.myServerFunction)(); // <=== KABOOM 💥 Your server related code can only be within your /cc @pcattori I wonder if we could somehow enhance the DX here. Repro is at https://github.com/gatesn/remix-redirect |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Remix are you using?
1.15.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
See a reproduction here: https://github.com/gatesn/remix-redirect/tree/main/app/routes
Create a
test.server.ts
file containing a function:Create a route that uses the server function at the top-level. I think this is wrong? Or it might be ok? But I spent a very long time trying to find the root cause of this issue so it would be helpful if an error appeared somewhere.
In some route, create a link to foo.
Expected Behavior
Either the page navigates to foo, or an error is thrown in the server or client.
Actual Behavior
On clicking the link, the browser calls the
foo
loader (if one exists), but then the page will refresh without navigating to /foo.Beta Was this translation helpful? Give feedback.
All reactions