Skip to content

Commit 49884f1

Browse files
authored
fix: clear import cache for pieces when using Bun (#492)
* fix: clear import cache for pieces when using Bun * fix: dynamic import URL cache workaround * refactor: use file.path instead of stripping the URL scheme
1 parent 2d12e59 commit 49884f1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/strategies/LoaderStrategy.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export class LoaderStrategy<T extends Piece> implements ILoaderStrategy<T> {
5757
url.searchParams.append('d', Date.now().toString());
5858
url.searchParams.append('name', file.name);
5959
url.searchParams.append('extension', file.extension);
60+
61+
// Bun workaround: Import a file path with search params instead of an file URL to force re-evaluation due to caching bug.
62+
if (Reflect.has(globalThis, 'Bun')) return mjsImport(file.path + url.search);
63+
6064
return mjsImport(url);
6165
}
6266

0 commit comments

Comments
 (0)