Skip to content

Multiple actions same route, action placement with nested routes, and resource route without export default #1298

Closed Answered by jangerhofer
Fghurayri asked this question in Q&A
Discussion options

You must be logged in to vote

Should a resource route export default something?

As you noted, a resource route definitely does not have to export default anything. It is a bit of a shot in the dark, but without additional knowledge of the specific error(s) blocking page loads when you omitted the default export, I am going to guess that Remix (or really esbuild under the hood) failed to split server code from client code. Specifically, my guess that code in ~/lib/utils/session which should only run on the server is bundled into your client build.

You can prevent this behavior by renaming the source file to include a .server.ts suffix.

Occasionally, the build may have trouble tree-shaking code that should only run o…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@slavabelaev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Fghurayri
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants