0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00

Fixes loading .ts configs in astro:db (#10342)

This commit is contained in:
Matthew Phillips 2024-03-06 09:50:02 -05:00 committed by GitHub
parent 1d9fb15a2d
commit a2e9b2b936
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
"astro": patch
"@astrojs/db": patch
---
Fixes @astrojs/db loading TS in the fixtures

View file

@ -21,6 +21,7 @@ async function createViteServer(root: string, fs: typeof fsType): Promise<ViteDe
'@astrojs/preact',
'@astrojs/sitemap',
'@astrojs/markdoc',
'@astrojs/db',
],
},
plugins: [loadFallbackPlugin({ fs, root: pathToFileURL(root) })],

View file

@ -106,7 +106,7 @@ export async function importBundledFile({
const tmpFileUrl = new URL(`./db.timestamp-${Date.now()}.mjs`, root);
await writeFile(tmpFileUrl, code, { encoding: 'utf8' });
try {
return await import(/* @vite-ignore */ tmpFileUrl.pathname);
return await import(/* @vite-ignore */ tmpFileUrl.toString());
} finally {
try {
await unlink(tmpFileUrl);