ViteConfig

interface ViteConfig(source)

The main configuration block, exposed by the vite extension:

plugins {
// …
}

vite {
// …
}

Properties

Link copied to clipboard
@get:Internal
abstract val base: Property<String>

Base public path when served in development or production.

Link copied to clipboard
abstract val build: ViteBuildConfig

Configuration for Rollup to build the production bundle.

Link copied to clipboard
@get:Internal
abstract val plugins: ListProperty<ExternalVitePlugin>

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

Link copied to clipboard
@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.

Link copied to clipboard
@get:Internal
abstract val root: DirectoryProperty

Project root directory, where index.html is located.

Link copied to clipboard
abstract val server: ViteServerConfig

Configuration for the development server.

Link copied to clipboard
@get:Internal
abstract val version: Property<String>

The version of the Vite package used by this build.

Functions

Link copied to clipboard
open fun build(block: ViteBuildConfig.() -> Unit): ViteBuildConfig
Link copied to clipboard
open fun plugin(packageName: String, exportedAs: String, version: String, configuration: String? = null, isNamedExport: Boolean = false)

Imports a plugin from NPM.

Link copied to clipboard
Link copied to clipboard
open fun setDefaults()

Sets the default values for all configuration fields.

Link copied to clipboard
open fun setDefaultsFrom(other: ViteConfig)