Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes loading .ts configs in astro:db #10342

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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