diff --git a/src/Illuminate/Foundation/Vite.php b/src/Illuminate/Foundation/Vite.php index 81278816abb8..b348992c20f2 100644 --- a/src/Illuminate/Foundation/Vite.php +++ b/src/Illuminate/Foundation/Vite.php @@ -897,7 +897,7 @@ public function content($asset, $buildDirectory = null) $chunk = $this->chunk($this->manifest($buildDirectory), $asset); - $path = public_path($buildDirectory.'/'.$chunk['file']); + $path = $this->publicPath($buildDirectory.'/'.$chunk['file']); if (! is_file($path) || ! file_exists($path)) { throw new ViteException("Unable to locate file from Vite manifest: {$path}."); @@ -918,6 +918,17 @@ protected function assetPath($path, $secure = null) return ($this->assetPathResolver ?? asset(...))($path, $secure); } + /** + * Generate a public path for an asset. + * + * @param string $path + * @return string + */ + protected function publicPath($path) + { + return public_path($path); + } + /** * Get the manifest file for the given build directory. *