From 454edf5e4828fdbab24838be07b3d10ad61c2ab2 Mon Sep 17 00:00:00 2001 From: Noah Gao Date: Fri, 21 Apr 2023 14:30:49 +0800 Subject: [PATCH] fix(loader): side effect of manifest item (#239) --- src/loader/factory.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/loader/factory.ts b/src/loader/factory.ts index a6bc1ca7..44733777 100644 --- a/src/loader/factory.ts +++ b/src/loader/factory.ts @@ -69,13 +69,15 @@ export class LoaderFactory { // group by loader names for (const item of itemList) { - item.path = root ? path.join(root, item.path) : item.path; - item.loader = item.loader ?? DEFAULT_LOADER; if (!itemMap.has(item.loader)) { // compatible for custom loader itemMap.set(item.loader, []); } - itemMap.get(item.loader)!.push(item); + itemMap.get(item.loader)!.push({ + ...item, + path: root ? path.join(root, item.path) : item.path, + loader: item.loader ?? DEFAULT_LOADER, + }); } // trigger loader