If you serve files in a path other /assets, you'll need to configure Vite's base property.
Is this example, we set the base to /static/ in production mode:
import { defineConfig } from "vite";
export default defineConfig(({ mode }) => ({
base: mode === "production" ? "/static/" : "/",
// ...
}));