Skip to content

Commit

Permalink
refactor: Updated the craft.vite.asset() function to work with Vite…
Browse files Browse the repository at this point in the history
… 3.x or later, where assets are stored as top-level entries in the `manifest.json` ([#56](nystudio107/craft-vite#56)) ([#31](nystudio107/craft-vite#31))
  • Loading branch information
khalwat committed Jan 25, 2023
1 parent 0431fca commit e3ad070
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/ViteService.php
Expand Up @@ -366,7 +366,11 @@ public function manifestAsset(string $path): string
}
}

return '';
// With Vite 3.x or later, the assets are also included as top-level entries in the
// manifest, so check there, too
$entry = ManifestHelper::extractEntry($path);

return $entry === '' ? '' : FileHelper::createUrl($this->serverPublic, $entry);
}

/**
Expand Down

0 comments on commit e3ad070

Please sign in to comment.