{"bugs":{"url":"https://github.com/survivejs/webpack-merge/issues"},"dist":{"shasum":"a877215aa6e1d12835185ec84fe5c9a8f4123709","tarball":"https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.0.0-beta-1.tgz","fileCount":16,"integrity":"sha512-VlDWmwd+g7zI4Cp0hphVvMBTtgrsLzCg82IQ7vDtRmMwn/wJrxihViSZeUx/+3RIb5KgDLaFynP6kqY6MDeT/w==","signatures":[{"sig":"MEQCIBsrfUEVzQgNW5BvLTI+I4VhS44U/FG5JBGvaEhMt3/KAiAgN3G9b9ZFs/VrdoN4SS8/LXiElJWSJsE6/KQP5crT6w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/0t9CRA9TVsSAnZWagAAk5kP+gIvxehA9NEPqeq3znHs\nAcQa9vBkgv7Hv+y6+F9jtasVkUYWML5WF0AChDKaJw166yRrH2H8riIRmo+8\nNmtchG1cb4X9RRWaOgZmeU+/6MRWnTie3cT5j7onzvrsYUagoJ7N8dd22yCP\nYu0gRaAOevZdjeLhRgQvIM9TXOGLbtteXPGT1AF6aqpy2eKpfUFhf8Qha0bo\nIApimrNRHBYjGJ9BikiwliWwYMaABm6sc8zTVVJyqCEdkhy569hMijUF7FO0\n5THzVntw6cRulex0EzE8QmkRHuLWFKZovzewD89fmAFm17sUWK11QsH5U0oB\nco2QPDcdB6egxdstjCIL65AWKypjINzrMo7n2EohF1KMWpAuS3gd4nHaRwfy\nMSBO8aCeIMx26lekbRsL45pU8fhcICWm4AQ8aLxI+chGyN6jud36VEY5/KBE\nJmuyZkwvmFjvPSqHQCgY3mKDZyGu2G11fuDwUciTJyz5l0XwgQIdtLQ1UShr\nuuLYNhjZYNPFM6XwZ3hALw/ymCeSzUeXEePZ2h+qpiLyn71MRX2iBHCvymzr\nvbn4AcVgVUQkfblv7OlvxaTcR7IA1Nn8aoLOB2cFVSImAIm/8muJA/8/3Vyg\nK+t0YffSfLhXsaWbfZgMoUk46uMlQgxlNKRHko/EMc/qzvAT0dsC9edn56XV\nh0r0\r\n=dBru\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"webpack-merge","husky":{"hooks":{"pre-commit":"npm run test"}},"author":{"name":"Juho Vepsalainen","email":"bebraw@gmail.com"},"readme":"[![Financial Contributors on Open Collective](https://opencollective.com/webpack-merge/all/badge.svg?label=financial+contributors)](https://opencollective.com/webpack-merge) [![build status](https://secure.travis-ci.org/survivejs/webpack-merge.svg)](http://travis-ci.org/survivejs/webpack-merge) [![codecov](https://codecov.io/gh/survivejs/webpack-merge/branch/master/graph/badge.svg)](https://codecov.io/gh/survivejs/webpack-merge)\n\n# webpack-merge - Merge designed for Webpack\n\n**webpack-merge** provides a `merge` function that concatenates arrays and merges objects creating a new object. If functions are encountered, it will execute them, run the results through the algorithm, and then wrap the returned values within a function again.\n\nThis behavior is particularly useful in configuring webpack although it has uses beyond it. Whenever you need to merge configuration objects, **webpack-merge** can come in handy.\n\n## Standard Merging\n\n### **`merge(...configuration | [...configuration])`**\n\n`merge` is the core, and the most important idea, of the API. Often this is all you need unless you want further customization.\n\n```javascript\nimport { merge } from 'webpack-merge';\n\n// Default API\nconst output = merge(object1, object2, object3, ...);\n\n// You can pass an array of objects directly.\n// This works with all available functions.\nconst output = merge([object1, object2, object3]);\n\n// Keys matching to the right take precedence:\nconst output = merge(\n  { fruit: \"apple\", color: \"red\" },\n  { fruit: \"strawberries\" }\n);\nconsole.log(output);\n// { color: \"red\", fruit: \"strawberries\"}\n```\n\n> Note that `Promise`s are not supported! If you want to return a configuration wrapped within a `Promise`, `merge` inside one. Example: `Promise.resolve(merge({ ... }, { ... }))`.\n\n### **`mergeWithCustomize({ customizeArray, customizeObject })(...configuration | [...configuration])`**\n\n`merge` behavior can be customized per field as below:\n\n```javascript\nimport { mergeWithCustomize } from 'webpack-merge';\n\nconst output = mergeWithCustomize(\n  {\n    customizeArray(a, b, key) {\n      if (key === 'extensions') {\n        return _.uniq([...a, ...b]);\n      }\n\n      // Fall back to default merging\n      return undefined;\n    },\n    customizeObject(a, b, key) {\n      if (key === 'module') {\n        // Custom merging\n        return _.merge({}, a, b);\n      }\n\n      // Fall back to default merging\n      return undefined;\n    }\n  }\n)(object1, object2, object3, ...);\n```\n\nFor example, if the previous code was invoked with only `object1` and `object2`\nwith `object1` as:\n\n```javascript\n{\n    foo1: ['object1'],\n    foo2: ['object1'],\n    bar1: { object1: {} },\n    bar2: { object1: {} },\n}\n```\n\nand `object2` as:\n\n```javascript\n{\n    foo1: ['object2'],\n    foo2: ['object2'],\n    bar1: { object2: {} },\n    bar2: { object2: {} },\n}\n```\n\nthen `customizeArray` will be invoked for each property of `Array` type, i.e:\n\n```javascript\ncustomizeArray([\"object1\"], [\"object2\"], \"foo1\");\ncustomizeArray([\"object1\"], [\"object2\"], \"foo2\");\n```\n\nand `customizeObject` will be invoked for each property of `Object` type, i.e:\n\n```javascript\ncustomizeObject({ object1: {} }, { object2: {} }, bar1);\ncustomizeObject({ object1: {} }, { object2: {} }, bar2);\n```\n\n### **`unique(<field>, <fields>, field => field)`**\n\nThe first `<field>` is the config property to look through for duplicates.\n\n`<fields>` represents the values that should be unique when you run the field => field function on each duplicate.\n\n```javascript\nimport { mergeWithCustomize, unique } from \"webpack-merge\";\n\nconst output = mergeWithCustomize({\n  customizeArray: unique(\n    \"plugins\",\n    [\"HotModuleReplacementPlugin\"],\n    (plugin) => plugin.constructor && plugin.constructor.name\n  ),\n})(\n  {\n    plugins: [new webpack.HotModuleReplacementPlugin()],\n  },\n  {\n    plugins: [new webpack.HotModuleReplacementPlugin()],\n  }\n);\n\n// Output contains only single HotModuleReplacementPlugin now.\n```\n\n### **`customizeArray`** and **`customizeObject`**\n\n`customizeArray` and `customizeObject` provide small strategies to for `mergeWithCustomize`. They support `append`, `prepend`, `replace`, and wildcards for field names.\n\n```javascript\nimport { mergeWithCustomize, customizeArray, customizeObject } from 'webpack-merge';\n\nconst output = mergeWithCustomize({\n  customizeArray: customizeArray({\n    'entry.*': 'prepend'\n  }),\n  customizeObject: customizeObject({\n    entry: 'prepend'\n  })\n})(object1, object2, object3, ...);\n```\n\n> Check out [SurviveJS - Webpack](http://survivejs.com/) to dig deeper into the topic.\n\n## Development\n\n1. `npm i`\n1. `npm t -- --watch`\n\nBefore contributing, please open an issue where to discuss.\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n<a href=\"https://github.com/survivejs/webpack-merge/graphs/contributors\"><img src=\"https://opencollective.com/webpack-merge/contributors.svg?width=890&button=false\" /></a>\n\n### Financial Contributors\n\nBecome a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/webpack-merge/contribute)]\n\n#### Individuals\n\n<a href=\"https://opencollective.com/webpack-merge\"><img src=\"https://opencollective.com/webpack-merge/individuals.svg?width=890\"></a>\n\n#### Organizations\n\nSupport this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/webpack-merge/contribute)]\n\n<a href=\"https://opencollective.com/webpack-merge/organization/0/website\"><img src=\"https://opencollective.com/webpack-merge/organization/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/1/website\"><img src=\"https://opencollective.com/webpack-merge/organization/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/2/website\"><img src=\"https://opencollective.com/webpack-merge/organization/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/3/website\"><img src=\"https://opencollective.com/webpack-merge/organization/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/4/website\"><img src=\"https://opencollective.com/webpack-merge/organization/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/5/website\"><img src=\"https://opencollective.com/webpack-merge/organization/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/6/website\"><img src=\"https://opencollective.com/webpack-merge/organization/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/7/website\"><img src=\"https://opencollective.com/webpack-merge/organization/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/8/website\"><img src=\"https://opencollective.com/webpack-merge/organization/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/webpack-merge/organization/9/website\"><img src=\"https://opencollective.com/webpack-merge/organization/9/avatar.svg\"></a>\n\n## License\n\n_webpack-merge_ is available under MIT. See LICENSE for more details.\n","engines":{"node":">=12.0.0"},"gitHead":"ee4fe4a18edd44384beefe6e9c55fc78d3abaabc","license":"MIT","scripts":{"test":"tsdx test","build":"tsdx build","start":"tsdx watch","format":"prettier . --write --ignore-path .gitignore","prepare":"tsdx build"},"_npmUser":{"name":"bebraw","email":"bebraw@gmail.com"},"homepage":"https://github.com/survivejs/webpack-merge","keywords":["webpack","merge"],"repository":{"url":"git+https://github.com/survivejs/webpack-merge.git","type":"git"},"_npmVersion":"6.14.5","description":"Variant of merge that's useful for webpack configuration","directories":{},"maintainers":[{"name":"bebraw","email":"bebraw@gmail.com"}],"_nodeVersion":"12.18.2","dependencies":{"wildcard":"^2.0.0","clone-deep":"^4.0.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsdx":"^0.13.2","husky":"^4.2.5","tslib":"^2.0.0","webpack":"^4.43.0","typescript":"^3.9.5","@types/webpack":"^4.41.18"},"_npmOperationalInternal":{"tmp":"tmp/webpack-merge_5.0.0-beta-1_1593789308760_0.703837591093111","host":"s3://npm-registry-packages"},"_id":"webpack-merge@5.0.0-beta-1","version":"5.0.0-beta-1"}