Optimizations
Agrume will duplicate the same client for each route. This is because we want the createRoute
function to be usable as such without any configuration. However, you can avoid this duplication by using the “optimized client”.
To start, paste this side effect at the top of your entry file (for example, main.ts
):
import '@agrume/client/optimized/register'
Then, in the plugin options, you can pass the optimized client:
// ...
import { getOptimizedClient } from '@agrume/client/optimized'
export default defineConfig({
plugins: [
agrume({
getClient: getOptimizedClient()
})
// ...
]
})