From 04ace1e9a913fe25bf1eff2bc7145d57f81d7485 Mon Sep 17 00:00:00 2001 From: Tanimodori Date: Sat, 25 Feb 2023 14:12:29 +0800 Subject: [PATCH] fix: workaround, fix #14 --- src/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 252015c..326e446 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -5,7 +5,11 @@ import path from 'path'; export function getSourceMapString(map?: SourceMap | null): string { if (!map) return ''; const mapDataString = JSON.stringify(map); - return `//# sourceMappingURL=data:application/json;base64,${Buffer.from(mapDataString).toString('base64')}`; + // splitted due to vite-node issue + // https://github.com/vitest-dev/vitest/issues/2918 + const resultA = `//# sourceMappingURL=data:`; + const resultB = `application/json;base64,${Buffer.from(mapDataString).toString('base64')}`; + return resultA + resultB; } export async function writeFile(file: string, content: string) {