-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate wrangler pages dev -- <PROXY_COMMAND>
#5211
Comments
pages dev -- <PROXY_COMMAND>
wrangler pages dev -- <PROXY_COMMAND>
@nevikashah @admah could you weigh in here from a product perspective? |
Given this is only deprecation and not removal there is no need to do this in a major version bump. |
The majority of the work here would actually be going through the docs and ensuring that all our guides avoid this usage. |
Given its use, I was thinking we'd want to consider deprecating in v3, letting it sit through v4 and then remove in v5. |
Yes. Exactly! |
Right, so I'm advocating on deprecating before we cut v4 which is why I added it to this milestone :) |
OK. That wasn't clear from the issue. 😄 |
User POV: I rely on this feature when working on project that use vitejs + pages functions, e.g: If this is deprecated what would the alternative be? A miniflare vite plugin? |
If I understand it correctly, the alternative is simply to run the vite server and wranger pages dev server side by side in separate terminals. For example, in one terminal: vite --port=5173 --strictPort And then in another terminal wrangler pages dev --proxy=5173 |
Although we would need to make a small fix in wrangler to ensure that we make use of the |
But actually, I think @GregBrimble's preferred approach would be to configure vite to watch and build to a directory that we then pass to Wrangler:
and
|
Yes, that's correct. Building to a directory is currently the only way to accurately emulate production's static asset serving behavior. |
@petebacondarwin thanks for the quick response, this mostly cover my use case, except for HMR (which I can live without) and live reload (with Edit: I created #5351 |
Is the best solution to this just to give up using HMR or live reload on Vite? My app was made using CRA and I just transitioned it to Vite, and found out that this was being deprecated. Should I switch back to CRA to use these features even though it's deprecated? Does running the Vite server and CF server (for functions) at the same time work? Would I need to edit my application code to use a different port when in a dev environment? |
This was very convenient to start Currently, I encounter this error when I start Wrangler with Vite as a proxy:
Yes, I have
Can anyone please help with how to deal with this? Sure, I can run vite and wrangler pages dev alongside each other, but it's not as convenient as using a proxy. Is there any way to add |
This is the only working method, separate process to run This workaround will never make it possible to have the project on development mode, since it requires building it, you will always be developing on production mode. |
Just wanted to share a configuration that's working for me so far and keeps vite's HMR. Add this to vite.config.js
Now run your vite app in dev mode as usual ( Then run
it will serve functions along with static assets which we will ignore. |
Can you confirm also if this fixes this: intlify/vue-i18n#1902 I will try myself, am just afk atm. |
Having /api as path to proxy adds an additional flag to keep eyes on, which is easy to forget about. All calls to api must be made now with double /api/api paths, in my case. Do you think vite will forward all request params to proxy calls? Without further debugging after removing api replace, wrangler throws 500's on every api call. |
Here I've made a copy of my current template for you. It's opinionated, but you will see the basic idea and it works. I've spent quite a lot of time experimenting and researching and this solution makes me happy. https://github.com/anri-asaturov/cloudflare-pages-spa-template |
And the supporting
--script-path
arg.It's unfortunately not fit for purpose and causes users more harm than benefit.
The text was updated successfully, but these errors were encountered: