Skip to content

Vite for Gradleopensavvy.gradle.vite.base.configViteConfig

ViteConfig

interface ViteConfig

The main configuration block, exposed by the vite extension:

plugins {
    // …
}

vite {
    // …
}

Properties

base

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

Base public path when served in development or production.

build

abstract val build: ViteBuildConfig

Configuration for Rollup to build the production bundle.

plugins

@get:
Internal
abstract val plugins: ListProperty<ExternalVitePlugin>

The list of Vite plugins from NPM imported by this project.

publicDir

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

Directory to serve as plain static assets. Files in this directory are served at / during dev and copied to the root outDir during build, and are always served or copied as-is without transform.

root

@get:
Internal
abstract val root: DirectoryProperty

Project root directory, where index.html is located.

server

abstract val server: ViteServerConfig

Configuration for the development server.

version

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

The version of the Vite package used by this build.

Functions

build

open fun build(block: ViteBuildConfig.() -> Unit): ViteBuildConfig

plugin

open fun plugin(packageName: String, exportedAs: String, version: String, configuration: String? = null, isNamedExport: Boolean = false)

Imports a plugin from NPM.

server

open fun server(block: ViteServerConfig.() -> Unit): ViteServerConfig

setDefaults

open fun setDefaults()

Sets the default values for all configuration fields.

setDefaultsFrom

open fun setDefaultsFrom(other: ViteConfig)