Skip to content

Commit

Permalink
Fixes loading .ts configs in astro:db (#10342)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored Mar 6, 2024
1 parent 1d9fb15 commit a2e9b2b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/dirty-games-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"astro": patch
"@astrojs/db": patch
---

Fixes @astrojs/db loading TS in the fixtures
1 change: 1 addition & 0 deletions packages/astro/src/core/config/vite-load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) })],
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/core/load-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a2e9b2b

Please sign in to comment.