The default preview port was changed to 4173 in Vite 2.8:
<https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#280-2022-02-09>
To avoid Vite preview server auto-increment the port number in the case
that port 4173 is occupied, therefore failing E2E tests unexpectedly,
we still have to explicitly set the port number in the npm scripts.
"scripts": {
"dev": "vite",
"build": "vite build",
- "preview": "vite preview --port 5050"
+ "preview": "vite preview --port 4173"
},
"dependencies": {
"vue": "^3.2.36"
{
- "baseUrl": "http://localhost:5050",
+ "baseUrl": "http://localhost:4173",
"component": {
"componentFolder": "src",
"testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
{
- "baseUrl": "http://localhost:5050"
+ "baseUrl": "http://localhost:4173"
}
{
"scripts": {
- "test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
- "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'"
+ "test:e2e": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress open'",
+ "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress run'"
},
"devDependencies": {
"cypress": "^9.7.0",