tettusud / merge-jsons-webpack-plugin

This plugin is used to merge json files into single json file,using glob or file names
https://npmjs.com/package/merge-jsons-webpack-plugin
Apache License 2.0
36 stars 20 forks source link

Array deepMerge function #63

Open TheLozyBozy opened 3 years ago

TheLozyBozy commented 3 years ago

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.

aarthishuba commented 3 years ago

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

jimmykane commented 7 months ago

Hi @aarthishuba where is this version ?

jimmykane commented 7 months ago

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/*" 
    ]
  }
}