Open firemuzzy opened 1 year ago
Best way achieve this is to use monorepo and import router definition from api server in extension. Here is a simple pnpm workspace monorepo, you can replace packages/website with extension.
@firemuzzy did you manage to solve this?
Best way achieve this is to use monorepo and import router definition from api server in extension. Here is a simple pnpm workspace monorepo, you can replace packages/website with extension.
This isn't what the question is about. The problem is that there is now a second hop before the backend server.
The structure looks like this and IDK what the best setup for it is. Start in content script -> go to background script -> make API call to the backend Backend response -> background script -> response in content script
Looked into this a bit. I'd love if ChromeHandler had the ability to take another link as a parameter, something like HttpBatchLink. That way we can specify what backend URL we would want to eventually ping
Hi @jlalmes, love the idea of having a typesafe communication with background thread.
I am trying to figure out the best way to update my extension to use TRPC throughout.
trpc-chrome
will give me type safe content scripts to background communication, but I also have the background script communicating with a trpc api server.Do you have a recommendation on the best way to do this, other than creating another TRPC client in the background tab to make calls to the server? I am trying to avoid duplication but can't think of another way to proxy the call through the background script to the api to preserver the types.