#Help getting custom context with Vite & Cloudflare

1 messages · Page 1 of 1 (latest)

vital geode
#

Hi, I followed the instructions on the Vite guide from the docs, specially the extending context part [1].
Some how after doing that, the extra things im passing down to the getLoadContext function are not shwoing up on the loaders context, please see screen for details:

  • functions/[[path]].ts with custom getLoadContext
  • getLoadContext with extended content object containing all the content api operations (the thing i want to inject)
  • a loader printing the context & showing up on the console with out the content prop

Could anyone help here please ?

1
https://remix.run/docs/en/main/guides/vite#augmenting-load-context

vital geode
#

Just found out, I was missing the counterpart passing down the loadContext fn on the vite config of remixCloudflareDevProxy({ getLoadContext }),.

vital geode
#

And now i get a failed to load config from /Users/dago/Desktop/sites/nawe/nawe_personalizado/site-rmx-vite/vite.config.ts Error [ERR_MODULE_NOT_FOUND]: Cannot find package '~' imported from... 🤪

If i remove all imports from the loadContext file, the error goes away. But that way i can not import the things i want to inject to beguin with.