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:
parent
1d9fb15a2d
commit
a2e9b2b936
4 changed files with 8 additions and 1 deletions
6
.changeset/dirty-games-jam.md
Normal file
6
.changeset/dirty-games-jam.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"astro": patch
|
||||
"@astrojs/db": patch
|
||||
---
|
||||
|
||||
Fixes @astrojs/db loading TS in the fixtures
|
|
@ -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) })],
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue