Where is staticFunctionMiddleware
I am trying to follow Static Server Functions, however i can't as
staticFunctionMiddleware
cannot be found anywhere. Is there any smart import to do? Or other library to install? Or some module augmentation?10 Replies
fascinating-indigo•2d ago
What version are you in? The docs are for 1.132.*
deep-jadeOP•2d ago
i have those versions installed
fascinating-indigo•2d ago
I think You must install the package first,
@tanstack/start-static-server-functions
deep-jadeOP•17h ago
right, it was there in the import... But now i am getting strange issue on line
.middleware([staticFunctionMiddleware])
which is
and when trying to ignore the error and run it anyway i get error in browser's console
gradual-turquoise•17h ago
before we go any deeper, what is it that you want to do with that middleware?
i am asking because the use case is rather niche
deep-jadeOP•15h ago
right, i just want to see how it works. I want to verify two things
- how it looks after build, so i want to inspect what was produced in bundles
- how it looks in the app and how it works (it will be obvious exercise, i just want eample of simple () => "Hello world" as a static server function)
And said "use case is niche", what is the use case then?
gradual-turquoise•15h ago
it allows you to produce sites that are fully static (no backend JS) but still load server side content from the client
deep-jadeOP•14h ago
hm ok, thanks
do you have maybe working example?
or can guide what steps to take to produce correct example?
thanks for your time and help so far
gradual-turquoise•14h ago
not right now, we will need to set one up
can you please create a github issue with a reproducer that exhibits the above problems so we can properly track this
deep-jadeOP•14h ago
of course, here it is https://github.com/TanStack/router/issues/5342
GitHub
Code snippet regarding staticFunctionMiddleware from docs is not wo...
Which project does this relate to? Start Describe the bug I just followed example from Static Server Functions and the example there import { createServerFn } from '@tanstack/react-start' i...