zuke.tools.vite

← Python API reference

@zuke/vite 1.1.0: @zuke/vite — typed ViteTasks wrappers for the [Vite](https://vitejs.dev) CLI, for use in Zuke builds.

Symbols

#

ViteBuildSettings

class
class ViteBuildSettings(ViteSettings)

Settings for vite build.

  • out_dir(path: str) -> Self

    Output directory (--outDir).

  • base(path: str) -> Self

    Public base path (--base).

  • empty_out_dir() -> Self

    Empty the output directory before building (--emptyOutDir).

  • sourcemap() -> Self

    Emit source maps (--sourcemap).

  • root(path: str) -> Self

    The project root (positional).

#

ViteDevSettings

class
class ViteDevSettings(ViteSettings)

Settings for vite dev (the development server).

  • host(value: str) -> Self

    Bind to a host/IP (--host).

  • port(value: float) -> Self

    Serve on a specific port (--port).

  • strict_port() -> Self

    Fail instead of trying the next free port when port is taken (--strictPort). A build that hands the port to something else — an e2e runner, a health check — needs the server to be on the port it asked for or not at all; without this Vite silently moves on and the other side connects to nothing.

  • open() -> Self

    Open the app in the browser on start (--open).

#

VitePreviewSettings

class
class VitePreviewSettings(ViteSettings)

Settings for vite preview (serve a production build locally).

  • host(value: str) -> Self

    Bind to a host/IP (--host).

  • port(value: float) -> Self

    Serve on a specific port (--port).

  • strict_port() -> Self

    Fail instead of trying the next free port when port is taken (--strictPort). See ViteDevSettings.strictPort.

  • open() -> Self

    Open the app in the browser on start (--open).

#

ViteSettings

class
class ViteSettings(ToolSettings)

Base for all vite subcommand settings: the binary is vite, with the --config and --mode options shared by every subcommand.

  • config(path: str) -> Self

    Use an explicit config file (--config).

  • mode(name: str) -> Self

    Set the mode, e.g. production or development (--mode).

#

ViteTasks

class
class ViteTasks

Typed task functions for the vite CLI.

  • static async dev(ctx: ServiceContext, configure: Callable[[ViteDevSettings], ViteDevSettings] | None=None) -> ExecResult

    Start the dev server: vite dev.

  • static async build(ctx: ServiceContext, configure: Callable[[ViteBuildSettings], ViteBuildSettings] | None=None) -> ExecResult

    Build for production: vite build.

  • static async preview(ctx: ServiceContext, configure: Callable[[VitePreviewSettings], VitePreviewSettings] | None=None) -> ExecResult

    Preview a production build: vite preview.