From 42ad3f01c57442de7c9d96dbccca4ddb3c1a5fa8 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Sun, 25 Dec 2022 23:26:50 +0200 Subject: [PATCH] Try reading the file without a query suffix Fixes #124 --- src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7eb805f..5e71f1a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,8 +36,13 @@ export default function sourcemaps({ try { code = (await promisifiedReadFile(id)).toString(); } catch { - this.warn('Failed reading file'); - return null; + try { + // Try without a query suffix that some plugins use + code = (await promisifiedReadFile(id.replace(/\?.*$/, ''))).toString(); + } catch (e) { + this.warn(`Failed reading file: ${e}`); + return null; + } } let map: ExistingRawSourceMap;