Vite has built-in support for serving static assets living in the
For example, if we save a file
public/robots.txt, then it will be served as-is at
Official docs: Vite - The
$ vite build, all static assets live in
Note how Vite:
b0c3b30bfor improved cachability.
If we use a Node.js production server (i.e. we don't pre-render our app),
we can alternatively use a server static middleware such as
We may want to do this if we have a lot of heavy static assets,
in order to avoid Vite from copying all our large static assets over to
dist/client/ and thus slowing down our build time.