$entrypoints Default entrypoints to load * @param string|null $nonce CSP nonce for inline scripts * @param bool $hotReload Whether to enable hot module replacement in dev */ public function __construct( public string $buildDirectory = 'assets', public string $manifestFileName = '.vite/manifest.json', public string $devServerUrl = 'https://localhost:3000', public array $entrypoints = ['main'], public ?string $nonce = null, public bool $hotReload = true ) { } /** * Get the full manifest path relative to public directory */ public function getManifestPath(string $publicPath): string { return rtrim($publicPath, '/') . '/' . ltrim($this->manifestFileName, '/'); } /** * Get the dev server entry URL */ public function getDevServerEntry(string $entry): string { return rtrim($this->devServerUrl, '/') . '/' . ltrim($entry, '/'); } /** * Get the Vite client URL for HMR */ public function getViteClientUrl(): string { return rtrim($this->devServerUrl, '/') . '/@vite/client'; } /** * Create config with custom entrypoints * * @param array $entrypoints */ public function withEntrypoints(array $entrypoints): self { return new self( buildDirectory: $this->buildDirectory, manifestFileName: $this->manifestFileName, devServerUrl: $this->devServerUrl, entrypoints: $entrypoints, nonce: $this->nonce, hotReload: $this->hotReload ); } /** * Create config with CSP nonce */ public function withNonce(string $nonce): self { return new self( buildDirectory: $this->buildDirectory, manifestFileName: $this->manifestFileName, devServerUrl: $this->devServerUrl, entrypoints: $this->entrypoints, nonce: $nonce, hotReload: $this->hotReload ); } }