tettusud / merge-jsons-webpack-plugin

This plugin is used to merge json files into single json file,using glob or file names

Home Page:https://npmjs.com/package/merge-jsons-webpack-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array deepMerge function

TheLozyBozy opened this issue · comments

Hi, I noticed that you use the concat array method in the mergeDeep function to concat both arrays together as a one array
Example:
1.json
{ "numbers": [1,2,3] }
2.json
{ "numbers": [4,5,6] }
The result:
{ "numbers": [1,2,3,4,5,6] }

I think this is the default behavior but I would like to suggest if you can add an option to control if we want to concat the arrays or override the values like this:

1.json
{ "numbers": [1,2,3] }
2.json
{ "numbers": [4,5,6] }
The result:
{ "numbers": [4,5,6] }

Thank you for this amazing plugin.

New version 2.0.0-alpha is published, it will by default behave the way its requested here.

Hi @aarthishuba where is this version ?

Ok using this version I see but there is no deep merge happening

{
  "host_permissions": [
    "http://localhost:8080/*",
    "http://localhost:8000/*",
    "http://localhost:8005/*"
  ],
  "externally_connectable": {
    "matches": [ // Here there is no merge with the other file's contents 
      "https://localhost:8000/*",
      "http://localhost:8080/*",
      "http://localhost:8005/*" 
    ]
  }
}