konsumer
konsumer
CDCloudflare Developers
Created by konsumer on 10/20/2023 in #pages-help
vite site + pages local-dev
I am trying to run vite react site with worker, with local live-reloading dev-server. I set this up:
{
scripts": {
"dev:frontend": "vite",
"dev:backend": "wrangler pages dev --proxy=http://localhost:5173/",
"start": "run-p dev:frontend dev:backend",
"build": "vite build"
}
}
{
scripts": {
"dev:frontend": "vite",
"dev:backend": "wrangler pages dev --proxy=http://localhost:5173/",
"start": "run-p dev:frontend dev:backend",
"build": "vite build"
}
}
So vite runs a local dev-server, then wrangler pages dev proxies pages to it. I hit the wrangler address http://127.0.0.1:8788 and I get an error about no --directory set. I set --directory to public (the static-asset dir for vite) and it 404s on index, but serves other files there. Should I proxy the other way? (hit vite, and proxy for backend to wrangler) Is there a better way to do this?
8 replies