Images binding locally with vite
This page teaches how to run the images binding locally with wrangler but not if we’re using vite.
has anyone managed to make it work while running vite? e.g.: environments in vite are passed as the
CLOUDFLARE_ENV
env variable.Cloudflare Docs
Bind to Workers API
A binding connects your Worker to external resources on the Developer Platform, like Images, R2 buckets, or KV Namespaces.
11 Replies
the reason why i want this is that some members of my team do not have access to cloudflare but still develop locally
Hm, my understanding is that you should be able to access bindings through the vite plugin as you would normally
sorry that’s not what i mean. i mean the experimental flag to run the image binding locally. if we don’t turn it then we need to login and the binding runs over a network request to cf
Could you elaborate a bit more on how you're trying to use the bindings through vite? (what's the stack)
react router + vite + cloudflare’s wrangler vite plugin
gotcha—so you're trying to use the experimental flag to run the image binding locally, with the vite plugin
yes
exactly
@freddie spent a while reading wrangler/vite plugin source code, it may be possible to set some value within .wrangler/deploy/config.json to enable this
GitHub
workers-sdk/packages/vite-plugin-cloudflare/src/deploy-config.ts at...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk
but I'm honestly not sure
i’ll give it a go today! the alternative is just not running images through it in dev mode which is just lower fidelity but works