Whenever i run npm run dev
, i get vite running on domain 127.0.0.1 by default.
How to make vite run on localhost instead?
Theses are my configs:
package.json:
"scripts": {
"dev": "vite --host=localhost",
"build": "vite build",
"preview": "vite preview"
},
vite.config.js:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: 'localhost',
port: 3000
}
})