{"_id":"webpack-configurator","_rev":"287048","name":"webpack-configurator","description":"Helper for creating and extending Webpack configuration structures.","dist-tags":{"latest":"0.3.1"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"time":{"modified":"2021-06-03T18:39:17.000Z","created":"2015-08-07T22:11:56.190Z","0.3.1":"2015-11-24T20:57:06.625Z","0.3.0":"2015-10-27T23:00:03.553Z","0.2.0":"2015-09-05T22:42:57.399Z","0.1.1":"2015-08-23T22:47:27.461Z","0.1.0":"2015-08-11T21:37:25.284Z","0.0.2":"2015-08-10T23:25:07.322Z","0.0.1":"2015-08-07T22:11:56.190Z"},"users":{},"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"versions":{"0.3.1":{"name":"webpack-configurator","version":"0.3.1","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"mocha"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"devDependencies":{"chai":"3.4.0","extract-text-webpack-plugin":"0.8.2","mocha":"2.3.3"},"gitHead":"e5253e26ba4f19184826d26bec09b91f369b5133","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.3.1","_shasum":"d16802afa674101a0cbfa6fc344d415c9649540b","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"dist":{"shasum":"d16802afa674101a0cbfa6fc344d415c9649540b","size":8791,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.3.1.tgz"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"directories":{},"publish_time":1448398626625,"_cnpm_publish_time":1448398626625,"_hasShrinkwrap":false},"0.3.0":{"name":"webpack-configurator","version":"0.3.0","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"mocha"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"devDependencies":{"chai":"3.4.0","extract-text-webpack-plugin":"0.8.2","mocha":"2.3.3"},"gitHead":"ccfa24c225255b59bfa4dedbffce172369d470bc","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.3.0","_shasum":"b4431facd83b8a6684134e312390b7d4e4487b0f","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"b4431facd83b8a6684134e312390b7d4e4487b0f","size":8277,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.3.0.tgz"},"directories":{},"publish_time":1445986803553,"_cnpm_publish_time":1445986803553,"_hasShrinkwrap":false},"0.2.0":{"name":"webpack-configurator","version":"0.2.0","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"gitHead":"3b0d2b45c76ebdc101ee51a55e6aa3e0f0347e3b","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.2.0","_shasum":"f41b3f204e86ee3c3818ff17e5e652e6ce88ba64","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"f41b3f204e86ee3c3818ff17e5e652e6ce88ba64","size":5520,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.2.0.tgz"},"directories":{},"publish_time":1441492977399,"_cnpm_publish_time":1441492977399,"_hasShrinkwrap":false},"0.1.1":{"name":"webpack-configurator","version":"0.1.1","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"gitHead":"3254575022e51d1cc6cd470b24233474c6e14abc","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.1.1","_shasum":"90f8b58a4797db1f2f28a938ab51a778bee1179c","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"90f8b58a4797db1f2f28a938ab51a778bee1179c","size":5709,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.1.1.tgz"},"directories":{},"publish_time":1440370047461,"_cnpm_publish_time":1440370047461,"_hasShrinkwrap":false},"0.1.0":{"name":"webpack-configurator","version":"0.1.0","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"gitHead":"745d8c48bd7c0b8e06b8fd4815ccdda7cfb5cd33","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.1.0","_shasum":"090585378252578b640da70d39c96e7e0bd7c4cd","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"090585378252578b640da70d39c96e7e0bd7c4cd","size":5682,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.1.0.tgz"},"directories":{},"publish_time":1439329045284,"_cnpm_publish_time":1439329045284,"_hasShrinkwrap":false},"0.0.2":{"name":"webpack-configurator","version":"0.0.2","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"repository":{"type":"git","url":"git+ssh://git@github.com/lewie9021/webpack-configurator.git"},"license":"MIT","dependencies":{"lodash":"3.10.1"},"gitHead":"7e4b0ee6c9335721e976cc70fc2425e9c57d79bd","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","_id":"webpack-configurator@0.0.2","_shasum":"2b9d9928b1d0edf744dfabaaa7b3b010bf1fc7c4","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"2b9d9928b1d0edf744dfabaaa7b3b010bf1fc7c4","size":5397,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.0.2.tgz"},"directories":{},"publish_time":1439249107322,"_cnpm_publish_time":1439249107322,"_hasShrinkwrap":false},"0.0.1":{"name":"webpack-configurator","version":"0.0.1","description":"Helper for creating and extending Webpack configuration structures.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack","config","extend","merge","loaders","plugins"],"author":{"name":"Lewis Barnes"},"license":"MIT","_id":"webpack-configurator@0.0.1","_shasum":"43cc0a9f3f9073add5ef4eb98e69a79dacddf794","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lewie9021","email":"lb.barnes@live.co.uk"},"maintainers":[{"name":"lewie9021","email":"lb.barnes@live.co.uk"}],"dist":{"shasum":"43cc0a9f3f9073add5ef4eb98e69a79dacddf794","size":418,"noattachment":false,"key":"/webpack-configurator/-/webpack-configurator-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-configurator/download/webpack-configurator-0.0.1.tgz"},"directories":{},"publish_time":1438985516190,"_cnpm_publish_time":1438985516190,"_hasShrinkwrap":false}},"readme":"# Webpack Configurator\r\n\r\n## Install\r\n\r\n```\r\n$ npm install webpack-configurator\r\n````\r\n\r\n## Motivation\r\n\r\nIn a number of my old projects, I found it difficult to DRY up the configuration files. My setup often contained a number of build modes (e.g. dev, test, and production), each sharing similar parts to one another. These common chunks were placed in a 'base' build mode. I wanted to still maintain the flexibility of including build mode specific configuration, while at the same time making slight changes to things such as loader query strings. In the end, I still found that my build mode files contained repetitive boilerplate code that I really wanted to avoid.\r\n\r\n## API\r\n\r\n### config.merge(config)\r\n\r\n<!-- Description of why you might want to use this method. -->\r\n\r\n**Arguments**\r\n\r\n1. `config` *(Object|Function)*: If an object is passed, this will be merged with the current value of config._config using the default way of merging (concat arrays nested within the data structure). If a function is passed, the first parameter will be a copy of the value contained within config._config. You can then make all the necessary changes to the data structure before returning the new value.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: The config object to allow function chaining.\r\n\r\n**Example**\r\n\r\n```javascript\r\n// Config as an object.\r\nconfig.merge({\r\n     entry: \"./app.entry.js\"\r\n});\r\n\r\n// Config as a function.\r\nconfig.merge(function(current) {\r\n    current.entry = \"./app.entry.js\";\r\n\r\n    return current;\r\n});\r\n```\r\n\r\n### config.loader(key, config, resolver)\r\n\r\nProvides a way of adding loaders to the config. You can add two other types of loaders using `config.preLoader` and `config.postLoader`.\r\n\r\n**Arguments**\r\n\r\n1. `key` *(String)*: Name of the loader. This is used to differentiate between loaders when merging/extending. When resolving, this value is used as a fallback for the 'loader' property value.\r\n2. `config` *(Object|Function)*: If an object is passed, this will be merged with the current value of the loader's config using the default way of merging (concat arrays nested within the data structure). If a function is passed, the first parameter will be a copy of the loader's config. You can then make all the necessary changes to the data structure before returning the new value.\r\n3. `resolver` *(Function)*: This works in a similar way to the `config` parameter, however, it is only called when resolving. It provides an opportunity to make final changes once the configuration is has been completely merged. **Note**: If the loader already has a resolver, the value will simply get replaced.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: The config object to allow function chaining.\r\n\r\n**Examples**\r\n\r\nConfig as an object.\r\n```javascript\r\nconfig.loader(\"dustjs-linkedin\", {\r\n    test: /\\.dust$/\r\n});\r\n```\r\n\r\nConfig as a function.\r\n```javascript\r\nconfig.loader(\"dustjs-linkedin\", function(current) {\r\n    current.test = /\\.dust$/;\r\n    \r\n    return current;\r\n});\r\n```\r\n\r\nConfig as an object with a resolver function.\r\n```javascript\r\nvar ExtractTextPlugin = require('extract-text-webpack-plugin');\r\n\r\nconfig.loader(\"sass\", {\r\n    test: /\\.scss$/,\r\n    queries: {\r\n        css: {\r\n            sourceMap: true\r\n        },\r\n        sass: {\r\n            sourceMap: true\r\n        }\r\n    }\r\n}, function(config) {\r\n    var loaders = [];\r\n\r\n    for (var key in config.queries)\r\n        loaders.push(key + \"?\" + JSON.stringify(config.queries[key]));\r\n\r\n    config.loader = ExtractTextPlugin.extract(loaders.join(\"!\"));\r\n\r\n    return config;\r\n});\r\n```\r\n<!--- An example of how merging works. -->\r\n\r\n### config.removeLoader(key)\r\n\r\nProvides a way to remove loaders without directly modifying internal data structures on the instance. You can remove two other types of loaders using the following: `config.removePreLoader(key)` and `config.removePostLoader(key)`.\r\n\r\n**Arguments**\r\n\r\n1. `key` *(String)*: Name of the loader you wish to remove. This is the same value used when calling the 'loader' method.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: The config object to allow function chaining.\r\n\r\n**Example**\r\n\r\n```javascript\r\n// Create a loader with the key 'dustjs-linkedin'\r\nconfig.loader(\"dustjs-linkedin\", {\r\n    test: /\\.dust$/\r\n});\r\n\r\n// Remove the loader using the same key as above.\r\nconfig.removeLoader(\"dustjs-linkedin\");\r\n```\r\n\r\n### config.plugin(key, constructor, parameters)\r\n\r\n<!-- Description of why you might want to use this method. -->\r\n\r\n**Arguments**\r\n\r\n1. `key` *(String)*: Name of the plugin. This is used to differentiate between plugins when merging/extending.\r\n2. `constructor` *(Class)*: The class constructor that you wish to be instantiated when resolving. **Note**: If the plugin already has a constructor, the value will simply get replaced. You may merge/extend `parameters` by passing null for this parameter.\r\n3. `parameters` *(Array|Function)*: If an array is passed, this will be merged with the current value of the plugin's parameters using the default way of merging (concat arrays nested within the data structure). If a function is passed, the first parameter will be a copy of the plugin's parameters array. You can then make all the necessary changes to the data structure before returning the new value. **Note** This must be an array.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: The config object to allow function chaining.\r\n\r\n**Examples**\r\n\r\nParameters as an array.\r\n```javascript\r\nvar Webpack = require(\"webpack\");\r\n\r\nconfig.plugin(\"webpack-define\", Webpack.DefinePlugin, [{\r\n    __DEV__: true\r\n}]);\r\n```\r\n\r\nParameters as a function.\r\n```javascript\r\nvar Webpack = require(\"webpack\");\r\n\r\nconfig.plugin(\"webpack-define\", Webpack.DefinePlugin, function(current) {\r\n    return [{\r\n        __DEV__: true\r\n    }];\r\n});\r\n```\r\n\r\n### config.removePlugin(key)\r\n\r\n<!-- Description of why you might want to use this method. -->\r\n\r\n**Arguments**\r\n\r\n1. `key` *(String)*: Name of the plugin you wish to remove. This is the same value used when calling the 'plugin' method.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: The config object to allow function chaining.\r\n\r\n**Example**\r\n\r\n```javascript\r\nvar Webpack = require(\"webpack\");\r\n\r\n// Create a plugin with the key 'webpack-define'.\r\nconfig.plugin(\"webpack-define\", Webpack.DefinePlugin, [{\r\n    __DEV__: true\r\n}]);\r\n\r\n// Remove the plugin using the same key as above.\r\nconfig.removePlugin(\"webpack-define\");\r\n```\r\n\r\n<!-- Show how it's more useful when extending... -->\r\n\r\n### config.resolve()\r\n\r\nCall when you want to return a complete Webpack configuration object, typically at the end. It can be called numerous times since it doesn't produce any side effects.\r\n\r\n**Returns**\r\n\r\n*`(Object)`*: A valid Webpack configuration object\r\n\r\n**Examples**\r\n\r\nA simple webpack.config.js file demonstrating the module's use.\r\n```javascript\r\nvar Config = require(\"webpack-configurator\");\r\nvar Webpack = require(\"webpack\");\r\n\r\nmodule.exports = (function() {\r\n    var config = new Config();\r\n\r\n    config.merge({\r\n        entry: \"./main.js\",\r\n        output: {\r\n            filename: \"bundle.js\"       \r\n        }\r\n    });\r\n\r\n    config.loader(\"dustjs-linkedin\", {\r\n        test: /\\.dust$/\r\n    });\r\n\r\n    config.loader(\"sass\", {\r\n        test: /\\.scss$/,\r\n        loader: \"style!css!sass?indentedSyntax\"\r\n    });\r\n\r\n    config.plugin(\"webpack-define\", Webpack.DefinePlugin, [{\r\n        VERSION: \"1.0.0\"\r\n    }]);\r\n\r\n    return config.resolve();\r\n})();\r\n```\r\n","_attachments":{},"homepage":"https://github.com/lewie9021/webpack-configurator#readme","bugs":{"url":"https://github.com/lewie9021/webpack-configurator/issues"},"license":"MIT"}