HEX
Server: Apache/2.4.18 (Ubuntu)
System: Linux ubuntu 7.0.5-x86_64-linode173 #1 SMP PREEMPT_DYNAMIC Fri May 8 10:12:05 EDT 2026 x86_64
User: root (0)
PHP: 7.2.28-1+ubuntu16.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //opt/code/node_modules/webpack-merge/package.json
{
  "name": "webpack-merge",
  "description": "Variant of merge that's useful for webpack configuration",
  "author": {
    "name": "Juho Vepsalainen",
    "email": "bebraw@gmail.com"
  },
  "version": "4.1.2",
  "scripts": {
    "build": "babel src -d lib",
    "watch": "npm-watch",
    "test": "mocha tests/test-*",
    "test:coverage": "istanbul cover node_modules/.bin/_mocha tests/test-*",
    "test:lint": "eslint src/ tests/ --cache",
    "preversion": "npm run test:lint && npm run build && npm test && git commit --allow-empty -am \"Update lib\""
  },
  "main": "lib/index.js",
  "files": [
    "lib"
  ],
  "dependencies": {
    "lodash": "^4.17.5"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-plugin-lodash": "^3.3.2",
    "babel-preset-es2015": "^6.24.1",
    "copy-webpack-plugin": "^4.4.1",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-jsx-a11y": "^3.0.2",
    "eslint-plugin-react": "^6.10.3",
    "git-prepush-hook": "^1.0.2",
    "istanbul": "^0.4.5",
    "mocha": "^3.5.3",
    "npm-watch": "^0.1.9",
    "webpack": "^1.15.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/survivejs/webpack-merge.git"
  },
  "homepage": "https://github.com/survivejs/webpack-merge",
  "bugs": {
    "url": "https://github.com/survivejs/webpack-merge/issues"
  },
  "keywords": [
    "webpack",
    "merge"
  ],
  "license": "MIT",
  "pre-push": [
    "test:lint",
    "build",
    "test"
  ],
  "watch": {
    "build": {
      "patterns": [
        "src/**/*.js"
      ]
    },
    "test": {
      "patterns": [
        "src/**/*.js",
        "tests/**/*.js"
      ]
    },
    "test:lint": {
      "patterns": [
        "src/**/*.js",
        "tests/**/*.js"
      ]
    }
  },
  "readme": "[![build status](https://secure.travis-ci.org/survivejs/webpack-merge.svg)](http://travis-ci.org/survivejs/webpack-merge) [![bitHound Score](https://www.bithound.io/github/survivejs/webpack-merge/badges/score.svg)](https://www.bithound.io/github/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\nThere's also a webpack specific merge variant known as `merge.smart` that's able to take webpack specifics into account (i.e., it can flatten loader definitions).\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\n// Default API\nvar output = merge(object1, object2, object3, ...);\n\n// You can pass an array of objects directly.\n// This works with all available functions.\nvar output = merge([object1, object2, object3]);\n```\n\n### **`merge({ customizeArray, customizeObject })(...configuration | [...configuration])`**\n\n`merge` behavior can be customized per field through a curried customization API.\n\n```javascript\n// Customizing array/object behavior\nvar output = merge(\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```\nFor example, if the previous code was invoked with only `object1` and `object2`\nwith `object1` as:\n```\n{\n    foo1: ['object1'],\n    foo2: ['object1'],\n    bar1: { object1: {} },\n    bar2: { object1: {} },\n}\n```\nand `object2` as:\n```\n{\n    foo1: ['object2'],\n    foo2: ['object2'],\n    bar1: { object2: {} },\n    bar2: { object2: {} },\n}\n```\nthen `customizeArray` will be invoked for each property of `Array` type, i.e:\n```\ncustomizeArray(['object1'], ['object2'], 'foo1');\ncustomizeArray(['object1'], ['object2'], 'foo2');\n```\nand `customizeObject` will be invoked for each property of `Object` type, i.e:\n```\ncustomizeObject({ object1: {} }, { object2: {} }, bar1);\ncustomizeObject({ object1: {} }, { object2: {} }, bar2);\n```\n\n### **`merge.unique(<field>, <fields>, field => field)`**\n\n```javascript\nconst output = merge({\n  customizeArray: merge.unique(\n    'plugins',\n    ['HotModuleReplacementPlugin'],\n    plugin => plugin.constructor && plugin.constructor.name\n  )\n})({\n  plugins: [\n    new webpack.HotModuleReplacementPlugin()\n  ]\n}, {\n  plugins: [\n    new webpack.HotModuleReplacementPlugin()\n  ]\n});\n\n// Output contains only single HotModuleReplacementPlugin now.\n```\n\n## Merging with Strategies\n\n### **`merge.strategy({ <field>: '<prepend|append|replace>''})(...configuration | [...configuration])`**\n\nGiven you may want to configure merging behavior per field, there's a strategy variant:\n\n```javascript\n// Merging with a specific merge strategy\nvar output = merge.strategy(\n  {\n    entry: 'prepend', // or 'replace', defaults to 'append'\n    'module.loaders': 'prepend'\n  }\n)(object1, object2, object3, ...);\n```\n\n### **`merge.smartStrategy({ <key>: '<prepend|append|replace>''})(...configuration | [...configuration])`**\n\nThe same idea works with smart merging too (described below in greater detail).\n\n```javascript\nvar output = merge.smartStrategy(\n  {\n    entry: 'prepend', // or 'replace'\n    'module.loaders': 'prepend'\n  }\n)(object1, object2, object3, ...);\n```\n\n## Smart Merging\n\n### **`merge.smart(...configuration | [...configuration])`**\n\n*webpack-merge* tries to be smart about merging loaders when `merge.smart` is used. Loaders with matching tests will be merged into a single loader value.\n\nNote that the logic picks up webpack 2 `rules` kind of syntax as well. The examples below have been written in webpack 1 syntax.\n\n**package.json**\n\n```json5\n{\n  \"scripts\": {\n    \"start\": \"webpack-dev-server\",\n    \"build\": \"webpack\"\n  },\n  // ...\n}\n```\n\n**webpack.config.js**\n\n```javascript\nvar path = require('path');\nvar merge = require('webpack-merge');\n\nvar TARGET = process.env.npm_lifecycle_event;\n\nvar common = {\n  entry: path.join(__dirname, 'app'),\n  ...\n  module: {\n    loaders: [\n      {\n        test: /\\.css$/,\n        loaders: ['style', 'css'],\n      },\n    ],\n  },\n};\n\nif(TARGET === 'start') {\n  module.exports = merge(common, {\n    module: {\n      // loaders will get concatenated!\n      loaders: [\n        {\n          test: /\\.jsx?$/,\n          loader: 'babel?stage=1',\n          include: path.join(ROOT_PATH, 'app'),\n        },\n      ],\n    },\n    ...\n  });\n}\n\nif(TARGET === 'build') {\n  module.exports = merge(common, {\n    ...\n  });\n}\n\n...\n```\n\n**Loader string values `loader: 'babel'` override each other.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'babel'\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'coffee'\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'coffee'\n  }]\n}\n```\n\n**Loader array values `loaders: ['babel']` will be merged, without duplication.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel']\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['coffee']\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    // appended because Webpack evaluated these from right to left\n    // this way you can specialize behavior and build the loader chain\n    loaders: ['babel', 'coffee']\n  }]\n}\n```\n\n**Loader array values `loaders: ['babel']` can be reordered by including\noriginal loaders.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel']\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['react-hot', 'babel']\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    // order of second argument is respected\n    loaders: ['react-hot', 'babel']\n  }]\n}\n```\n\n**Loader query strings `loaders: ['babel?plugins[]=object-assign']` will be overridden.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel?plugins[]=object-assign']\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel', 'coffee']\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel', 'coffee']\n  }]\n}\n```\n\n**Loader arrays in source values will have loader strings merged into them.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'babel'\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['coffee']\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    // appended because Webpack evaluated these from right to left!\n    loaders: ['babel', 'coffee']\n  }]\n}\n```\n\n**Loader strings in source values will always override.**\n\n```javascript\nmerge.smart({\n  loaders: [{\n    test: /\\.js$/,\n    loaders: ['babel']\n  }]\n}, {\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'coffee'\n  }]\n});\n// will become\n{\n  loaders: [{\n    test: /\\.js$/,\n    loader: 'coffee'\n  }]\n}\n```\n\n## Multiple Merging\n\n### **`merge.multiple(...configuration | [...configuration])`**\n\nSometimes you may need to support multiple targets, *webpack-merge* will accept an object where each key represents the target configuration. The output becomes an *array* of configurations where matching keys are merged and non-matching keys are added.\n\n```javascript\nvar path = require('path');\nvar baseConfig = {\n    server: {\n      target: 'node',\n      output: {\n        path: path.resolve(__dirname, 'dist'),\n        filename: 'lib.node.js'\n      }\n    },\n    client: {\n      output: {\n        path: path.resolve(__dirname, 'dist'),\n        filename: 'lib.js'\n      }\n    }\n  };\n\n// specialized configuration\nvar production = {\n    client: {\n      output: {\n        path: path.resolve(__dirname, 'dist'),\n        filename: '[name].[hash].js'\n      }\n    }\n  }\n\nmodule.exports = merge.multiple(baseConfig, production)\n```\n\n> Check out [SurviveJS - Webpack and React](http://survivejs.com/) to dig deeper into the topic.\n\n## Development\n\n1. `npm i`\n2. `npm run watch`\n\nBefore contributing, please open an issue where to discuss.\n\n## License\n\n*webpack-merge* is available under MIT. See LICENSE for more details.\n",
  "readmeFilename": "README.md",
  "_id": "webpack-merge@4.1.2",
  "dist": {
    "shasum": "6a325192a60c2c6d4352429ab48176e940c1daa6"
  },
  "_from": "webpack-merge@^4.1.0",
  "_resolved": "http://registry.npmjs.org/webpack-merge/-/webpack-merge-4.1.2.tgz"
}