Vite does not support the devServer Proxy option

48 Views Asked by At

Good morning, I am a person who for a lot of years has always used the Vuejs 2 framework to write WebApps, given that Vuejs 2 is about to become "Obsolete" I started to see the various migration guides between Vuejs 2 to Vuejs 3;

All these guides tell me to replace the current VueCLI I have with a new CLI called Vite which from what I read will become the new standard by retiring the VueCLI;

I followed a lot of guides, I watched a lot of videos;

Yet, despite having managed after blood and tears to update my WebApps from Vuejs 2 to Vuejs also changing the store from Vuex to Pinia, updated all the libraries I use to make them suitable for the new Vuejs 3, when I try to migrate between VueCLI An error happens to me in Vite and from what I read on the internet it seems that I am the only person to receive this error. Now I'll explain:

In VueCLI with my vue.config.js file I have a part that is written like this:

devServer: {
   proxy: {
     "": {
       target: "http://localhost:8092",
       ws: false,
       changeOrigin: true
     },
   },
},

To do the Vine Migration I wrote like this:

server: {
   proxy: {
     "": "http://localhost:8092",
   },
},

Yet it doesn't seem to work while with VueCLI everything works;

I don't understand if I wrote it wrong or if I'm missing some option. What do you think is the reason why this part of server.proxy doesn't seem to work in Vite?

I read the official VITE docs but without results;

I also tried asking chatGPT but it couldn't help me there either;

I tried searching on the internet and it seems that no one has this type of problem;

If any of you can explain to me why I have this problem, perhaps by illustrating "where I'm going wrong" or perhaps give me some "how to" guide, I would be grateful for life so that I can "retire" the VueCLI and have fun with the new VITE;

0

There are 0 best solutions below