-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Dev Server says "Upgrade Required", browser has CORS-issues since Vite version 2.9.0 #8602
Comments
Hello @passchn. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
I prepared a StackBlitz here: https://stackblitz.com/edit/vitejs-vite-sdtxq1?file=README.md The browser also shows "Upgrade required" with this hmr-config for versions from 2.9.0 and higher. Note that a php-setup would be a little different. The php is served by Apache and Vite would serve the scripts on it's own port. The console on StackBlitz is now logging the following information which I did not get before:
|
I assume #7282 is affecting this. Commenting out this line fixes it. It seems there is a edge case bug. server: {
hmr: {
protocol: 'ws',
host: 'localhost',
// port: 3000,
},
},
|
Ok, I tested it with my php setup and that seems to be the problem indeed. This does not work:
But this works:
I need to have a fixed port as php needs to "mirror" the config as well. Thank you! |
It was not a bug. It was working correctly. IIUC your requiements are:
So this config will meet your requirements. server: {
port: 3000,
strictPort: true
}, |
Oh, that's true. It needs |
Describe the bug
Hello Vite!
I'm the author of this plugin for Vite and Silverstripe CMS, this plugin for CakePHP, and I use this configuration.
Until now, everything worked fine with the dev server, hot module replacement etc. However, after running
yarn upgrade
i noticed that the dev server is not working anymore. The browser is complaining about cors-issues - see screenshot below:I tried to downgrade vite step by step and the issue seems to be present from version
2.9.0
. Is there any configuration that I missed which has to be present?As I use Vite in php apps, I serve my PHP with MAMP (e.g.
https://my-domain.local
) and the js from vite gets served by the vite dev server fromlocalhost:3000
, through this configuration:When accessing one of the localhost urls, I now only get an
Upgrade required
warning. In the network tab I see that the browser got ahttp 426
response from the dev server, similar to this issue: #5770However, reinstalling did not solve the problem. I have now locked the version in
package.json
tovite 2.8.6
which works for now, but I hope I will be able to keep Vite up to date in the future.If this is a bug, I am happy to help with further information. Otherwise it would be great to get a hint about how to solve this problem.
Reproduction
https://github.com/brandcom/silverstripe-vite
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: