How to use --persist-to flag when starting local FE with e.g., vite dev?
I have a monorepo where a number of packages share the same D1, KV, etc. For local DX it would be great to be able to create one local version and reuse it across all packages.
This is achievable when starting local Workers etc by appending the
--persist-to ../path/here
flag to wrangler dev
.
Is there an equivalent way to point my frontend to the persisted resource? I.e., start the SvelteKit dev server (via vite dev
) and have it use the persisted resource instead of create another .wrangler/
directory in the FE directory2 Replies
Reading through this post from April 2024 Blazing fast development with full stack frameworks and Cloudflare makes me think there might be a way via getPlatformProxy which can accept an argument like
persist: "./my-directory/v3"
. However I can't see how to actually make use of this knowledge 😅You can set the options for
getPlatformProxy
in adapter-cloudflare
Remember to append /v3
to the adapter persist path because getPlatformProxy does not add that by default, whereas wrangler --persist-to
does
Cloudflare Pages • Docs • Svelte
Cloudflare Pages • Svelte documentation