Andrew
All backend imports becoming accessible on frontend?
I've been pretty surprised by how blase the internet has been about making the backend server package a dependency of the frontend with tRPC. It seems quite risky to accidentally pull in sensitive backend code. Here's what we did:
1. Add as the backend package as a TS project reference, and use a special path so it's easy to know:
2. Then in your frontend code:
3. Don't add the backend package to your frontend
package.json
. This means when you write out the type manually, TS knows what to do with it, but intellisense won't try to serve up exports from backend when you're in the frontend code.
It feels incredibly jank and hacky, but so far it seems to be working.10 replies
Find Usages of a procedure do not show client calls.
Thanks for the response! Interestingly, finding references on
list:
works on VS Code, but not on WebStorm. For WS it appears to do nothing at all.
A slight wrench in that approach is we're planning to spread the module in, like this:
Not a dealbreaker, and we could change that, but we're hoping to cut back on boilerplate for defining new endpoints.
I'm curious if anyone's found an approach that works for WebStorm?4 replies