Sveltekit VITE v3.0.2 localhost changed from 3000 to 5173

Viewed 1680

July 20th 2022 New Sveltekit project created by npm init svelte@next. Before today all sveltekit projects were run in dev mode on localhost:3000. This current project is running on localhost:5173 which makes it difficult as supabase returns responses to localhost:3000 by default. I have tried changing the package.json as in https://www.cloudhadoop.com/svelte-change-port/ That did not work. I have tried changing the Vite server options as in https://main.vitejs.dev/config/server-options.html#server-host That didn't work either. Has anyone got a foolproof easy way of getting new Sveltekit projects on localhost:3000? Many thanks

1 Answers

Starting from 1.0.0-next.359, SvelteKit switched to Vite CLI for dev, build, and preview commands.

Therefore, the default port changed to 5173, which is the default value of the Vite server.port.

You can change the port value in vite.config.js as well, a file which is now required.

Reference Vite / Config / Server Options for more information.

Related