Skip to content

Commit

Permalink
fix(swc): deepMerge didn't handle array type properly
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfulyang committed Jul 7, 2023
1 parent 1b9ab26 commit bc18e83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/compiler/swc/swc-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ export class SwcCompiler extends BaseCompiler {
return source;
}

if (Array.isArray(target) && Array.isArray(source)) {
return source.reduce((acc, value, index) => {
acc[index] = this.deepMerge(target[index], value);
return acc;
}, target);
}

const merged = { ...target };
for (const key in source) {
if (source.hasOwnProperty(key)) {
Expand Down

0 comments on commit bc18e83

Please sign in to comment.