fix(node/bundler): Prevent spreading string into return (#2335)

This commit is contained in:
Amos Wong 2021-10-03 22:16:48 +08:00 committed by GitHub
parent a7357ab517
commit f42616698c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}`);