A server function that is not available in production
I'm adding a server function that will only be used in development, I was wondering if there's a way to mark it as such and remove it from the final bundle.
I'm currently calling it from a custom plugin in tanstack devtools. I've tried to put a condition like
import.meta.DEV && customPlugin
to force it to only be added in dev, but after buliding the app I can still seed the server function in the bundle.4 Replies
extended-salmon•2w ago
can you please provide a complete minimal example of what you are trying to do here? then we can have a look how that could be realized
absent-sapphireOP•2w ago
Will do
absent-sapphireOP•2w ago
Here's a repo with the setup I'm talking about.
https://github.com/MAST1999/optional-server-fn-start
GitHub
GitHub - MAST1999/optional-server-fn-start
Contribute to MAST1999/optional-server-fn-start development by creating an account on GitHub.
absent-sapphireOP•2w ago
If you build it the devtool will be missing but the server fn is still in the bundle.