From 5633ba65d5107907c1ba00ad37371c5531c6ec6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan-Eric=20N=C3=A6ss?= Date: Wed, 20 Mar 2024 00:23:43 +0100 Subject: [PATCH] Use new import glob parameters --- src/assets/util.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/util.ts b/src/assets/util.ts index 0e10c26..800814e 100644 --- a/src/assets/util.ts +++ b/src/assets/util.ts @@ -17,7 +17,7 @@ export interface Audio { rate?: number; } -const imageGlob = import.meta.glob('./images/**/*.png', {as: 'url', eager: true}); +const imageGlob = import.meta.glob('./images/**/*.png', {query: '?url', import: 'default', eager: true}); export const image = (path: string, key: string): Image => { return { key, path: imageGlob[`./images/${path}.png`] }; } @@ -26,17 +26,17 @@ export const spritesheet = (path: string, key: string, width: number, height: nu return { key, width, height, path: imageGlob[`./images/${path}.png`] }; } -const musicGlob = import.meta.glob('./music/**/*.mp3', {as: 'url', eager: true}); +const musicGlob = import.meta.glob('./music/**/*.mp3', {query: '?url', import: 'default', eager: true}); export const music = (path: string, key: string, volume?: number, rate?: number): Audio => { return { key, volume, rate, path: musicGlob[`./music/${path}.mp3`] }; } -const audioGlob = import.meta.glob('./sounds/**/*.mp3', {as: 'url', eager: true}); +const audioGlob = import.meta.glob('./sounds/**/*.mp3', {query: '?url', import: 'default', eager: true}); export const sound = (path: string, key: string, volume?: number, rate?: number): Audio => { return { key, volume, rate, path: audioGlob[`./sounds/${path}.mp3`] }; } -const fontGlob = import.meta.glob('./fonts/**/*.ttf', {as: 'url', eager: true}); +const fontGlob = import.meta.glob('./fonts/**/*.ttf', {query: '?url', import: 'default', eager: true}); export const loadFont = async (path: string, name: string) => { const face = new FontFace(name, `url(${fontGlob[`./fonts/${path}.ttf`]})`, {style: 'normal', weight: '400'}); await face.load();