Replies: 2 comments 3 replies
-
You can use If you're using Cloudflare you can import |
Beta Was this translation helpful? Give feedback.
2 replies
-
In Remix, we used a custom server.ts file, does this also work in RR7? Yes this also work on RR the same way as in Remix |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I need to access my environment variables in RR7 loaders to make api requests with api keys and or secrets within the loaders during ssr without exposing keys and secrets. After Migrating from Remix, I am no longer able to access any data from loader contexts nor is there any documentation on how to set the AppLoadContext besides typing it, which does nothing for actually using it. There are no examples how to do this in the docs for framework mode.
I have a .server file which contains env variable properties. This works well imported directly into my root loader, but these variables are needed in multiple loaders.
env.server.ts
In Remix, we used a custom server.ts file, does this also work in RR7? I have tried this same approch in RR7 without luck. All examples only use the params so i'm assuming this may have been moved to vite? Literally no documentation exists on this with the upgrade from remix.
server.ts
Unstable Context
entry.client.tsx
Current Solution
I am exporting a loader that processes the env where necessary.
env.server.ts
root.tsx
Although this works well, importing this loader to multiple components Is not the way I would like to take this a step forward and have these values available in the AppLoadContext. I have read several posts on this topic and they all mentioned typing the context and then seeing the values, whats missing in all these post is the part about populating the context. Once again RR7 framework mode out of the box.
react-router.config.ts
package.json
Beta Was this translation helpful? Give feedback.
All reactions