@@ -14,11 +14,13 @@ class Vite extends LaravelVite
14
14
*
15
15
* @param string|array $entrypoints The list of entry points for Vite
16
16
* @param string|null $package The package name of the plugin or theme
17
+ * @param string|null $buildDirectory The Vite build directory
18
+ *
17
19
* @return HtmlString
18
20
*
19
21
* @throws SystemException
20
22
*/
21
- public function __invoke ($ entrypoints , $ package = null )
23
+ public function __invoke ($ entrypoints , $ package = null , $ buildDirectory = null )
22
24
{
23
25
if (!$ package ) {
24
26
throw new \InvalidArgumentException ('A package must be passed ' );
@@ -32,19 +34,20 @@ public function __invoke($entrypoints, $package = null)
32
34
}
33
35
34
36
$ this ->useHotFile (base_path ($ compilableAssetPackage ['path ' ] . '/assets/dist/hot ' ));
35
- return parent ::__invoke ($ entrypoints , $ compilableAssetPackage ['path ' ] . '/assets/dist ' );
37
+ return parent ::__invoke ($ entrypoints , $ compilableAssetPackage ['path ' ] . ( $ buildDirectory ?? '/assets/dist ' ) );
36
38
}
37
39
38
40
/**
39
41
* Helper method to generate Vite tags for an entrypoint(s).
40
42
*
41
43
* @param string|array $entrypoints The list of entry points for Vite
42
44
* @param string $package The package name of the plugin or theme
45
+ * @param string|null $buildDirectory The Vite build directory
43
46
*
44
47
* @throws SystemException
45
48
*/
46
- public static function tags (array |string $ entrypoints , string $ package ): HtmlString
49
+ public static function tags (array |string $ entrypoints , string $ package, ? string $ buildDirectory = null ): HtmlString
47
50
{
48
- return App::make (\Illuminate \Foundation \Vite::class)($ entrypoints , $ package );
51
+ return App::make (\Illuminate \Foundation \Vite::class)($ entrypoints , $ package, $ buildDirectory );
49
52
}
50
53
}
0 commit comments