Skip to content

Commit bd33494

Browse files
committed
modified: src/index.ts
1 parent 8c6172b commit bd33494

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ import { useStyleTag } from "@vueuse/core";
1717
import hash from "hash-sum";
1818
import { transform } from "sucrase";
1919

20-
const fetchText = async (url: string) => {
20+
const body = "<template></template>",
21+
fetchText = async (url: string) => {
2122
try {
2223
const response = await fetch(url);
23-
return response.ok ? response : new Response("");
24+
return response.ok ? response : new Response(body);
2425
} catch {
25-
return new Response("");
26+
return new Response(body);
2627
}
2728
},
2829
log = (msgs: (CompilerError | Error | string)[]) => {
@@ -51,10 +52,8 @@ const addStyle = async (
5152
),
5253
loadModule = async (filename: string) => {
5354
const { descriptor, errors } = parse(
54-
await (await fetchText(filename)).text(),
55-
{
56-
filename,
57-
},
55+
(await (await fetchText(filename)).text()) || body,
56+
{ filename },
5857
);
5958
const compilerOptions: CompilerOptions = { expressionPlugins: [] },
6059
scriptBlocks = ["script", "scriptSetup"],

0 commit comments

Comments
 (0)