How to change the default port in Vite? #23123
Answered
by
AmritaMalik
itsamritamalik-ctrl
asked this question in
Q&A
|
I am new to Vite. I want to run my project on a different port instead of the default port 5173. How can I change the port number in Vite? |
Answered by
AmritaMalik
Aug 1, 2026
Replies: 2 comments
|
You can change the default port in Vite by updating the vite.config.js file. Example: import { defineConfig } from 'vite' export default defineConfig({ After saving the file, restart the Vite server. Your app will run on port 3000. |
0 replies
Answer selected by
itsamritamalik-ctrl
|
You can change the Vite port by editing the vite.config.js file. Add the server option: import { defineConfig } from 'vite'
export default defineConfig({
server: {
port: 3000
}
}) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can change the default port in Vite by updating the vite.config.js file.
Example:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 3000
}
})
After saving the file, restart the Vite server. Your app will run on port 3000.