From f42616698c3fd5c8bf86421c92c33f3f6e43c05c Mon Sep 17 00:00:00 2001 From: Amos Wong Date: Sun, 3 Oct 2021 22:16:48 +0800 Subject: [PATCH] fix(node/bundler): Prevent spreading string into return (#2335) --- node-swc/src/spack.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node-swc/src/spack.ts b/node-swc/src/spack.ts index d57e099451b2..3e3a3f5599b7 100644 --- a/node-swc/src/spack.ts +++ b/node-swc/src/spack.ts @@ -22,7 +22,11 @@ export async function compileBundleOptions(config: BundleInput | string | undefi } return configFromFile; } - return Object.assign({}, configFromFile, config); + + return { + ...configFromFile, + ...(typeof config === 'string') ? {} : config + }; } catch (e) { if (typeof f === 'string') { throw new Error(`Error occurred while loading config file at ${config}: ${e}`);