Skip to content

Commit

Permalink
feat: switch to absolute asset path
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Sep 11, 2024
1 parent bd7d5ae commit 9e6695d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Vite.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,16 @@ public static function build($entrypoints, $buildDirectory = null)

$preloads->push([
$chunk['src'],
static::assetPath("{$buildDirectory}/{$chunk['file']}"),
static::assetPath($chunk['file']),
$chunk,
$manifest,
]);


foreach ($chunk['imports'] ?? [] as $import) {
$preloads->push([
$import,
static::assetPath("{$buildDirectory}/{$manifest[$import]['file']}"),
static::assetPath($manifest[$import]['file']),
$manifest[$import],
$manifest,
]);
Expand All @@ -259,14 +260,14 @@ public static function build($entrypoints, $buildDirectory = null)

$preloads->push([
$partialManifest->keys()->first(),
static::assetPath("{$buildDirectory}/{$css}"),
static::assetPath($css),
$partialManifest->first(),
$manifest,
]);

$tags->push(static::makeTagForChunk(
$partialManifest->keys()->first(),
static::assetPath("{$buildDirectory}/{$css}"),
static::assetPath($css),
$partialManifest->first(),
$manifest
));
Expand All @@ -275,24 +276,25 @@ public static function build($entrypoints, $buildDirectory = null)

$tags->push(static::makeTagForChunk(
$entrypoint,
static::assetPath("{$buildDirectory}/{$chunk['file']}"),
static::assetPath($chunk['file']),
$chunk,
$manifest
));

foreach ($chunk['css'] ?? [] as $css) {
$partialManifest = Collection::make($manifest)->where('file', $css);


$preloads->push([
$partialManifest->keys()->first(),
static::assetPath("{$buildDirectory}/{$css}"),
static::assetPath($css),
$partialManifest->first(),
$manifest,
]);

$tags->push(static::makeTagForChunk(
$partialManifest->keys()->first(),
static::assetPath("{$buildDirectory}/{$css}"),
static::assetPath($css),
$partialManifest->first(),
$manifest
));
Expand Down Expand Up @@ -588,7 +590,7 @@ public static function asset($asset, $buildDirectory = null)

$chunk = static::chunk(static::manifest($buildDirectory), $asset);

return static::assetPath($buildDirectory . '/' . $chunk['file']);
return static::assetPath($chunk['file']);
}

/**
Expand Down

0 comments on commit 9e6695d

Please sign in to comment.