Skip to content

Commit

Permalink
Add dynamic asset util
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Jul 26, 2023
1 parent 2deae43 commit 4eeb58a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/dynamicAsset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const dynamicAsset = (path: string) => {
const assets = import.meta.glob('~/assets/**/*', { eager: true });
const fullPath = `/assets` + path;
return assets[fullPath]?.default;

Check failure on line 4 in utils/dynamicAsset.ts

View workflow job for this annotation

GitHub Actions / Typecheck

Property 'default' does not exist on type '{}'.
};

0 comments on commit 4eeb58a

Please sign in to comment.