Skip to content

ViteServerConfig

interface ViteServerConfig

Development server options.

vite {
   server {
       // …
   }
}

Properties

host

@get:Internal
abstract val host: Property<String>

Specify which IP addresses the server should listen on.

Set this to 0.0.0.0 to listen on all addresses, including LAN and public addresses.

Example

vite {
    server {
        host = "localhost"
    }
}

External resources

port

@get:Internal
abstract val port: Property<Int>

Specify server port.

Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on.

Example

vite {
    server {
        port = 5173
    }
}

External resources

proxies

@get:Internal
abstract val proxies: ListProperty<ProxyOptions>

Configures the proxies started by the Vite development server.

Example

vite {
    server {
        proxy("/foo", "http://localhost:4567")
    }
}

External resources

See also

strictPort

@get:Internal
abstract val strictPort: Property<Boolean>

Set to true to exit if port is already in use, instead of automatically trying the next available port.

Example

vite {
    server {
        strictPort = false
    }
}

External resources

Functions

proxy

open fun proxy(
    url: String, 
    target: String, 
    changeOrigin: Boolean = false, 
    ws: Boolean = false, 
    replacePrefixBy: String? = null
)

Configures the proxies started by the Vite development server.

Example

vite {
    server {
        proxy("/foo", "http://localhost:4567")
    }
}

External resources