Config¶
- class litestar_vite.config.ViteConfig[source]¶
Bases:
object
Configuration for ViteJS support.
To enable Vite integration, pass an instance of this class to the
Litestar
constructor using the ‘plugins’ key.- bundle_dir: Path | str = 'public'¶
Location of the compiled assets from Vite.
The manifest file will also be found here.
- resource_dir: Path | str = 'resources'¶
The directory where all typescript/javascript source are written.
In a standalone Vue or React application, this would be equivalent to the
./src
directory.
- public_dir: Path | str = 'public'¶
The optional public directory Vite serves assets from.
In a standalone Vue or React application, this would be equivalent to the
./public
directory.
- hot_file: str = 'hot'¶
Name of the hot file.
This file contains a single line containing the host, protocol, and port the Vite server is running.
- root_dir: Path | str | None = None¶
The is the base path to your application.
In a standalone Vue or React application, this would be equivalent to the top-level project folder containing the
./src
directory.
- asset_url: str¶
Base URL to generate for static asset references.
This URL will be prepended to anything generated from Vite.
- __init__(bundle_dir: ~pathlib.Path | str = 'public', resource_dir: ~pathlib.Path | str = 'resources', public_dir: ~pathlib.Path | str = 'public', manifest_name: str = 'manifest.json', hot_file: str = 'hot', hot_reload: bool = <factory>, ssr_enabled: bool = False, ssr_output_dir: ~pathlib.Path | str | None = None, root_dir: ~pathlib.Path | str | None = None, is_react: bool = False, asset_url: str = <factory>, host: str = <factory>, protocol: str = 'http', port: int = <factory>, run_command: list[str] = <factory>, build_watch_command: list[str] = <factory>, build_command: list[str] = <factory>, install_command: list[str] = <factory>, use_server_lifespan: bool = <factory>, dev_mode: bool = <factory>, detect_nodeenv: bool = True, set_environment: bool = True, set_static_folders: bool = True) None ¶
- detect_nodeenv: bool = True¶
When True, The initializer will install and configure nodeenv if present
- set_environment: bool = True¶
When True, configuration in this class will be set into environment variables.
This can be useful to ensure Vite always uses the configuration supplied to the plugin