{"_id":"webpack-5-chain","_rev":"3441719","name":"webpack-5-chain","description":"[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![CI Status][ci-image]][ci-url]","dist-tags":{"latest":"8.0.2"},"maintainers":[{"name":"sorrycc","email":""}],"time":{"modified":"2024-08-27T19:25:37.000Z","created":"2021-08-25T02:52:11.457Z","8.0.2":"2024-05-15T09:13:03.112Z","8.0.1":"2022-06-30T05:19:34.030Z","8.0.0":"2021-08-25T04:11:55.339Z","7.0.0":"2021-08-25T02:52:11.457Z"},"users":{},"author":{"name":"Eli Perelman","email":"eli@eliperelman.com"},"repository":{"type":"git","url":"git+https://github.com/sorrycc/webpack-chain.git"},"versions":{"8.0.2":{"name":"webpack-5-chain","version":"8.0.2","main":"src/Config.js","typings":"types/index.d.ts","repository":{"type":"git","url":"git+https://github.com/sorrycc/webpack-chain.git"},"keywords":["webpack","config","chain","fluent","api"],"engines":{"node":">=10"},"author":{"name":"Eli Perelman","email":"eli@eliperelman.com"},"license":"MPL-2.0","scripts":{"fix":"yarn lint:fix && yarn style:fix","lint":"eslint --cache --max-warnings 0 --format codeframe .","lint:fix":"yarn lint --fix","style":"prettier --check .","style:fix":"prettier --write .","test":"jest","test:types":"tsc -p ./types/test/tsconfig.json","changelog":"auto-changelog --remote upstream --commit-limit false","version":"yarn changelog --package && git add CHANGELOG.md"},"dependencies":{"deepmerge":"^1.5.2","javascript-stringify":"^2.0.1"},"devDependencies":{"@types/enhanced-resolve":"^3.0.6","@types/tapable":"^1.0.6","@types/webpack":"^5.0.0","auto-changelog":"^2.2.0","enhanced-resolve":"^5.8.2","eslint":"^7.5.0","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jest":"^24.0.0","jest":"^27.0.0","prettier":"^2.0.5","typescript":"^4.0.0","webpack":"^5.0.0"},"_id":"webpack-5-chain@8.0.2","gitHead":"80203ccdf6ed61ffda67eaf4839dcb542d6001eb","description":"[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![CI Status][ci-image]][ci-url]","bugs":{"url":"https://github.com/sorrycc/webpack-chain/issues"},"homepage":"https://github.com/sorrycc/webpack-chain#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"shasum":"058bad8118af33f241425b7dc60ab374deb5a5f6","size":25414,"noattachment":false,"key":"/webpack-5-chain/-/webpack-5-chain-8.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-5-chain/download/webpack-5-chain-8.0.2.tgz"},"_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"directories":{},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-5-chain_8.0.2_1715764382973_0.9955876800213039"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-05-15T09:13:03.112Z","publish_time":1715764383112,"_source_registry_name":"default","_cnpm_publish_time":1715764383112},"8.0.1":{"name":"webpack-5-chain","version":"8.0.1","main":"src/Config.js","typings":"types/index.d.ts","repository":{"type":"git","url":"git+https://github.com/sorrycc/webpack-chain.git"},"keywords":["webpack","config","chain","fluent","api"],"engines":{"node":">=10"},"author":{"name":"Eli Perelman","email":"eli@eliperelman.com"},"license":"MPL-2.0","scripts":{"fix":"yarn lint:fix && yarn style:fix","lint":"eslint --cache --max-warnings 0 --format codeframe .","lint:fix":"yarn lint --fix","style":"prettier --check .","style:fix":"prettier --write .","test":"jest","test:types":"tsc -p ./types/test/tsconfig.json","changelog":"auto-changelog --remote upstream --commit-limit false","version":"yarn changelog --package && git add CHANGELOG.md"},"dependencies":{"deepmerge":"^1.5.2","javascript-stringify":"^2.0.1"},"devDependencies":{"@types/enhanced-resolve":"^3.0.6","@types/tapable":"^1.0.6","@types/webpack":"^5.0.0","auto-changelog":"^2.2.0","enhanced-resolve":"^5.8.2","eslint":"^7.5.0","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jest":"^24.0.0","jest":"^27.0.0","prettier":"^2.0.5","typescript":"^4.0.0","webpack":"^5.0.0"},"gitHead":"168a6986d464982510a236b9ac2cb677c6d0ed79","description":"[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![CI Status][ci-image]][ci-url]","bugs":{"url":"https://github.com/sorrycc/webpack-chain/issues"},"homepage":"https://github.com/sorrycc/webpack-chain#readme","_id":"webpack-5-chain@8.0.1","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"shasum":"dda9db48c19e4e01e535e84241131bcc777243d8","size":25370,"noattachment":false,"key":"/webpack-5-chain/-/webpack-5-chain-8.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-5-chain/download/webpack-5-chain-8.0.1.tgz"},"_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"directories":{},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-5-chain_8.0.1_1656566373890_0.3272507397868991"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-06-30T05:29:48.479Z","publish_time":1656566374030,"_cnpm_publish_time":1656566374030},"8.0.0":{"name":"webpack-5-chain","version":"8.0.0","main":"src/Config.js","typings":"types/index.d.ts","repository":{"type":"git","url":"git+https://github.com/sorrycc/webpack-5-chain.git"},"keywords":["webpack","config","chain","fluent","api"],"engines":{"node":">=10"},"author":{"name":"Eli Perelman","email":"eli@eliperelman.com"},"license":"MPL-2.0","scripts":{"fix":"yarn lint:fix && yarn style:fix","lint":"eslint --cache --max-warnings 0 --format codeframe .","lint:fix":"yarn lint --fix","style":"prettier --check .","style:fix":"prettier --write .","test":"jest","test:types":"tsc -p ./types/test/tsconfig.json","changelog":"auto-changelog --remote upstream --commit-limit false","version":"yarn changelog --package && git add CHANGELOG.md"},"dependencies":{"deepmerge":"^1.5.2","javascript-stringify":"^2.0.1"},"devDependencies":{"@types/enhanced-resolve":"^3.0.6","@types/tapable":"^1.0.6","@types/webpack":"^5.0.0","auto-changelog":"^2.2.0","enhanced-resolve":"^5.8.2","eslint":"^7.5.0","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jest":"^24.0.0","jest":"^27.0.0","prettier":"^2.0.5","typescript":"^4.0.0","webpack":"^5.0.0"},"gitHead":"6936fa45909dbe0d05d3da1efddbc52d0dd91c4d","description":"[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![CI Status][ci-image]][ci-url]","bugs":{"url":"https://github.com/sorrycc/webpack-5-chain/issues"},"homepage":"https://github.com/sorrycc/webpack-5-chain#readme","_id":"webpack-5-chain@8.0.0","_nodeVersion":"15.14.0","_npmVersion":"7.7.6","dist":{"shasum":"71021060e0f1ea03465f4afb3fb9b965c18fe26a","size":28287,"noattachment":false,"key":"/webpack-5-chain/-/webpack-5-chain-8.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-5-chain/download/webpack-5-chain-8.0.0.tgz"},"_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"directories":{},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-5-chain_8.0.0_1629864715195_0.5592210904480264"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T19:48:10.925Z","publish_time":1629864715339,"_cnpm_publish_time":1629864715339},"7.0.0":{"name":"webpack-5-chain","version":"7.0.0","main":"src/Config.js","typings":"types/index.d.ts","repository":{"type":"git","url":"git+https://github.com/sorrycc/webpack-5-chain.git"},"keywords":["webpack","config","chain","fluent","api"],"engines":{"node":">=10"},"author":{"name":"Eli Perelman","email":"eli@eliperelman.com"},"license":"MPL-2.0","scripts":{"fix":"yarn lint:fix && yarn style:fix","lint":"eslint --cache --max-warnings 0 --format codeframe .","lint:fix":"yarn lint --fix","style":"prettier --check .","style:fix":"prettier --write .","test":"jest","test:types":"tsc -p ./types/test/tsconfig.json","changelog":"auto-changelog --remote upstream --commit-limit false","version":"yarn changelog --package && git add CHANGELOG.md"},"dependencies":{"deepmerge":"^1.5.2","javascript-stringify":"^2.0.1"},"devDependencies":{"@types/enhanced-resolve":"^3.0.6","@types/tapable":"^1.0.6","@types/webpack":"^4.41.21","auto-changelog":"^2.2.0","eslint":"^7.5.0","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jest":"^24.0.0","jest":"^25.3.0","prettier":"^2.0.5","typescript":"^4.0.0","webpack":"^4.43.0"},"gitHead":"10017d759e4479e9f4e67320e16f1e5d7c887949","description":"[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Build Status][travis-image]][travis-url]","bugs":{"url":"https://github.com/sorrycc/webpack-5-chain/issues"},"homepage":"https://github.com/sorrycc/webpack-5-chain#readme","_id":"webpack-5-chain@7.0.0","_nodeVersion":"15.14.0","_npmVersion":"7.7.6","dist":{"shasum":"f8d1591351bdf9e25393bec26acf4d70891bcf4e","size":24599,"noattachment":false,"key":"/webpack-5-chain/-/webpack-5-chain-7.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/webpack-5-chain/download/webpack-5-chain-7.0.0.tgz"},"_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"directories":{},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-5-chain_7.0.0_1629859931282_0.8708591933601773"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T19:48:09.858Z","publish_time":1629859931457,"_cnpm_publish_time":1629859931457}},"readme":"# webpack-chain\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][npm-downloads]][npm-url]\n[![CI Status][ci-image]][ci-url]\n\nUse a chaining API to generate and simplify the modification of webpack 4 configurations.\n\nThis documentation corresponds to v6 of webpack-chain. For previous versions, see:\n\n* [v5 docs](https://github.com/neutrinojs/webpack-chain/tree/v5)\n* [v4 docs](https://github.com/neutrinojs/webpack-chain/tree/v4)\n* [v3 docs](https://github.com/neutrinojs/webpack-chain/tree/v3)\n* [v2 docs](https://github.com/neutrinojs/webpack-chain/tree/v2)\n* [v1 docs](https://github.com/neutrinojs/webpack-chain/tree/v1)\n\n_Note: while webpack-chain is utilized extensively in Neutrino, this package is\ncompletely standalone and can be used by any project._\n\n**[Chinese docs(中文文档)](https://github.com/Yatoo2018/webpack-chain/tree/zh-cmn-Hans)**\n\n## Introduction\n\nwebpack's core configuration is based on creating and modifying a\npotentially unwieldy JavaScript object. While this is OK for configurations\non individual projects, trying to share these objects across projects and\nmake subsequent modifications gets messy, as you need to have a deep\nunderstanding of the underlying object structure to make those changes.\n\n`webpack-chain` attempts to improve this process by providing a chainable or\nfluent API for creating and modifying webpack configurations. Key portions\nof the API can be referenced by user-specified names, which helps to\nstandardize how to modify a configuration across projects.\n\nThis is easier explained through the examples following.\n\n## Installation\n\n`webpack-chain` requires Node.js 10 or higher. `webpack-chain` also only creates\nconfiguration objects designed for use with webpack 4.\n\nYou may install this package using either Yarn or npm (choose one):\n\n**Yarn**\n\n```bash\nyarn add --dev webpack-chain\n```\n\n**npm**\n\n```bash\nnpm install --save-dev webpack-chain\n```\n\n## Getting Started\n\nOnce you have `webpack-chain` installed, you can start creating a\nwebpack configuration. For this guide, our example base configuration will\nbe `webpack.config.js` in the root of our project directory.\n\n```js\n// Require the webpack-chain module. This module exports a single\n// constructor function for creating a configuration API.\nconst Config = require('webpack-chain');\n\n// Instantiate the configuration with a new API\nconst config = new Config();\n\n// Make configuration changes using the chain API.\n// Every API call tracks a change to the stored configuration.\n\nconfig\n  // Interact with entry points\n  .entry('index')\n    .add('src/index.js')\n    .end()\n  // Modify output settings\n  .output\n    .path('dist')\n    .filename('[name].bundle.js');\n\n// Create named rules which can be modified later\nconfig.module\n  .rule('lint')\n    .test(/\\.js$/)\n    .pre()\n    .include\n      .add('src')\n      .end()\n    // Even create named uses (loaders)\n    .use('eslint')\n      .loader('eslint-loader')\n      .options({\n        rules: {\n          semi: 'off'\n        }\n      });\n\nconfig.module\n  .rule('compile')\n    .test(/\\.js$/)\n    .include\n      .add('src')\n      .add('test')\n      .end()\n    .use('babel')\n      .loader('babel-loader')\n      .options({\n        presets: [\n          ['@babel/preset-env', { modules: false }]\n        ]\n      });\n\n// Create named plugins too!\nconfig\n  .plugin('clean')\n    .use(CleanPlugin, [['dist'], { root: '/dir' }]);\n\n// Export the completed configuration object to be consumed by webpack\nmodule.exports = config.toConfig();\n```\n\nHaving shared configurations is also simple. Just export the configuration\nand call `.toConfig()` prior to passing to webpack.\n\n```js\n// webpack.core.js\nconst Config = require('webpack-chain');\nconst config = new Config();\n\n// Make configuration shared across targets\n// ...\n\nmodule.exports = config;\n\n// webpack.dev.js\nconst config = require('./webpack.core');\n\n// Dev-specific configuration\n// ...\nmodule.exports = config.toConfig();\n\n// webpack.prod.js\nconst config = require('./webpack.core');\n\n// Production-specific configuration\n// ...\nmodule.exports = config.toConfig();\n```\n\n## ChainedMap\n\nOne of the core API interfaces in webpack-chain is a `ChainedMap`. A\n`ChainedMap` operates similar to a JavaScript Map, with some conveniences for\nchaining and generating configuration. If a property is marked as being a\n`ChainedMap`, it will have an API and methods as described below:\n\n**Unless stated otherwise, these methods will return the `ChainedMap`, allowing\nyou to chain these methods.**\n\n```js\n// Remove all entries from a Map.\nclear()\n```\n\n```js\n// Remove a single entry from a Map given its key.\n// key: *\ndelete(key)\n```\n\n```js\n// Fetch the value from a Map located at the corresponding key.\n// key: *\n// returns: value\nget(key)\n```\n\n```js\n// Fetch the value from a Map located at the corresponding key.\n// If the key is missing, the key is set to the result of function fn.\n// key: *\n// fn: Function () -> value\n// returns: value\ngetOrCompute(key, fn)\n```\n\n```js\n// Set a value on the Map stored at the `key` location.\n// key: *\n// value: *\nset(key, value)\n```\n\n```js\n// Returns `true` or `false` based on whether a Map as has a value set at a\n// particular key.\n// key: *\n// returns: Boolean\nhas(key)\n```\n\n```js\n// Returns an array of all the values stored in the Map.\n// returns: Array\nvalues()\n```\n\n```js\n// Returns an object of all the entries in the backing Map\n// where the key is the object property, and the value\n// corresponding to the key. Will return `undefined` if the backing\n// Map is empty.\n// This will order properties by their name if the value is\n// a ChainedMap that used .before() or .after().\n// returns: Object, undefined if empty\nentries()\n```\n\n```js\n// Provide an object which maps its properties and values\n// into the backing Map as keys and values.\n// You can also provide an array as the second argument\n// for property names to omit from being merged.\n// obj: Object\n// omit: Optional Array\nmerge(obj, omit)\n```\n\n```js\n// Execute a function against the current configuration context\n// handler: Function -> ChainedMap\n  // A function which is given a single argument of the ChainedMap instance\nbatch(handler)\n```\n\n```js\n// Conditionally execute a function to continue configuration\n// condition: Boolean\n// whenTruthy: Function -> ChainedMap\n  // invoked when condition is truthy, given a single argument of the ChainedMap instance\n// whenFalsy: Optional Function -> ChainedMap\n  // invoked when condition is falsy, given a single argument of the ChainedMap instance\nwhen(condition, whenTruthy, whenFalsy)\n```\n\n## ChainedValueMap\n\n`ChainedValueMap` inherited `ChainedMap` but callable. call it by value means to \nset it to it and clean all data in map. set any key/value in map will clear value \nsetted by call it.\n\nIt is chainable,so calling it will return the original instance, allowing you to continue to chain.\nFor example, `config.node` is a `ChainedValueMap` instance, so it can be used as:\n\n```js\n// call as function will setting a value on a ChainedMap\nconfig.node(false);\n\n// use as `ChainedMap`\nconfig.node.set('amd', 'true');\n```\n\n## ChainedSet\n\nAnother of the core API interfaces in webpack-chain is a `ChainedSet`. A\n`ChainedSet` operates similar to a JavaScript Set, with some conveniences for\nchaining and generating configuration. If a property is marked as being a\n`ChainedSet`, it will have an API and methods as described below:\n\n**Unless stated otherwise, these methods will return the `ChainedSet`, allowing\nyou to chain these methods.**\n\n```js\n// Add/append a value to the end of a Set.\n// value: *\nadd(value)\n```\n\n```js\n// Add a value to the beginning of a Set.\n// value: *\nprepend(value)\n```\n\n```js\n// Remove all values from a Set.\nclear()\n```\n\n```js\n// Remove a specific value from a Set.\n// value: *\ndelete(value)\n```\n\n```js\n// Returns `true` or `false` based on whether or not the\n// backing Set contains the specified value.\n// value: *\n// returns: Boolean\nhas(value)\n```\n\n```js\n// Returns an array of values contained in the backing Set.\n// returns: Array\nvalues()\n```\n\n```js\n// Concatenates the given array to the end of the backing Set.\n// arr: Array\nmerge(arr)\n```\n\n```js\n// Execute a function against the current configuration context\n// handler: Function -> ChainedSet\n  // A function which is given a single argument of the ChainedSet instance\nbatch(handler)\n```\n\n```js\n// Conditionally execute a function to continue configuration\n// condition: Boolean\n// whenTruthy: Function -> ChainedSet\n  // invoked when condition is truthy, given a single argument of the ChainedSet instance\n// whenFalsy: Optional Function -> ChainedSet\n  // invoked when condition is falsy, given a single argument of the ChainedSet instance\nwhen(condition, whenTruthy, whenFalsy)\n```\n\n## Shorthand methods\n\nA number of shorthand methods exist for setting a value on a `ChainedMap`\nwith the same key as the shorthand method name.\nFor example, `devServer.hot` is a shorthand method, so it can be used as:\n\n```js\n// A shorthand method for setting a value on a ChainedMap\ndevServer.hot(true);\n\n// This would be equivalent to:\ndevServer.set('hot', true);\n```\n\nA shorthand method is chainable, so calling it will return the original\ninstance, allowing you to continue to chain.\n\n### Config\n\nCreate a new configuration object.\n\n```js\nconst Config = require('webpack-chain');\n\nconst config = new Config();\n```\n\nMoving to deeper points in the API will change the context of what you\nare modifying. You can move back to the higher context by either referencing\nthe top-level `config` again, or by calling `.end()` to move up one level.\nIf you are familiar with jQuery, `.end()` works similarly. All API calls\nwill return the API instance at the current context unless otherwise\nspecified. This is so you may chain API calls continuously if desired.\n\nFor details on the specific values that are valid for all shorthand and\nlow-level methods, please refer to their corresponding name in the\n[webpack docs hierarchy](https://webpack.js.org/configuration/).\n\n```js\nConfig : ChainedMap\n```\n\n#### Config shorthand methods\n\n```js\nconfig\n  .context(context)\n  .mode(mode)\n  .devtool(devtool)\n  .target(target)\n  .watch(watch)\n  .watchOptions(watchOptions)\n  .externals(externals)\n  .externalsType(externalsType)\n  .externalsPresets(externalsPresets)\n  .stats(stats)\n  .experiments(experiments)\n  .amd(amd)\n  .bail(bail)\n  .cache(cache)\n  .dependencies(dependencies)\n  .ignoreWarnings(ignoreWarnings)\n  .loader(loader)\n  .parallelism(parallelism)\n  .profile(profile)\n  .recordsPath(recordsPath)\n  .recordsInputPath(recordsInputPath)\n  .recordsOutputPath(recordsOutputPath)\n  .name(name)\n  .infrastructureLogging(infrastructureLogging)\n  .snapshot(snapshot)\n```\n\n#### Config entryPoints\n\n```js\n// Backed at config.entryPoints : ChainedMap\nconfig.entry(name) : ChainedSet\n\nconfig\n  .entry(name)\n    .add(value)\n    .add(value)\n\nconfig\n  .entry(name)\n    .clear()\n\n// Using low-level config.entryPoints:\n\nconfig.entryPoints\n  .get(name)\n    .add(value)\n    .add(value)\n\nconfig.entryPoints\n  .get(name)\n    .clear()\n```\n\n#### Config output: shorthand methods\n\n```js\nconfig.output : ChainedMap\n\nconfig.output\n  .auxiliaryComment(auxiliaryComment)\n  .charset(charset)\n  .chunkFilename(chunkFilename)\n  .chunkLoadTimeout(chunkLoadTimeout)\n  .chunkLoadingGlobal(chunkLoadingGlobal)\n  .chunkLoading(chunkLoading)\n  .chunkFormat(chunkFormat)\n  .enabledChunkLoadingTypes(enabledChunkLoadingTypes)\n  .crossOriginLoading(crossOriginLoading)\n  .devtoolFallbackModuleFilenameTemplate(devtoolFallbackModuleFilenameTemplate)\n  .devtoolModuleFilenameTemplate(devtoolModuleFilenameTemplate)\n  .devtoolNamespace(devtoolNamespace)\n  .filename(filename)\n  .assetModuleFilename(assetModuleFilename)\n  .globalObject(globalObject)\n  .uniqueName(uniqueName)\n  .hashDigest(hashDigest)\n  .hashDigestLength(hashDigestLength)\n  .hashFunction(hashFunction)\n  .hashSalt(hashSalt)\n  .hotUpdateChunkFilename(hotUpdateChunkFilename)\n  .hotUpdateFunction(hotUpdateFunction)\n  .hotUpdateMainFilename(hotUpdateMainFilename)\n  .library(library)\n  .libraryExport(libraryExport)\n  .libraryTarget(libraryTarget)\n  .importFunctionName(importFunctionName)\n  .path(path)\n  .pathinfo(pathinfo)\n  .publicPath(publicPath)\n  .scriptType(scriptType)\n  .sourceMapFilename(sourceMapFilename)\n  .sourcePrefix(sourcePrefix)\n  .strictModuleErrorHandling(strictModuleErrorHandling)\n  .strictModuleExceptionHandling(strictModuleExceptionHandling)\n  .umdNamedDefine(umdNamedDefine)\n  .workerChunkLoading(workerChunkLoading)\n  .enabledLibraryTypes(enabledLibraryTypes)\n  .environment(environment)\n  .compareBeforeEmit(compareBeforeEmit)\n  .wasmLoading(wasmLoading)\n  .enabledWasmLoadingTypes(enabledWasmLoadingTypes)\n  .iife(iife)\n  .module(module)\n  .clean(clean)\n```\n\n#### Config resolve: shorthand methods\n\n```js\nconfig.resolve : ChainedMap\n\nconfig.resolve\n  .cachePredicate(cachePredicate)\n  .cacheWithContext(cacheWithContext)\n  .enforceExtension(enforceExtension)\n  .symlinks(symlinks)\n  .unsafeCache(unsafeCache)\n  .preferRelative(preferRelative)\n  .preferAbsolute(preferAbsolute)\n```\n\n#### Config resolve alias\n\n```js\nconfig.resolve.alias : ChainedMap\n\nconfig.resolve.alias\n  .set(key, value)\n  .set(key, value)\n  .delete(key)\n  .clear()\n```\n\n#### Config resolve aliasFields\n\n```js\nconfig.resolve.aliasFields : ChainedSet\n\nconfig.resolve.aliasFields\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolve descriptionFields\n\n```js\nconfig.resolve.descriptionFields : ChainedSet\n\nconfig.resolve.descriptionFields\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolve extensions\n\n```js\nconfig.resolve.extensions : ChainedSet\n\nconfig.resolve.extensions\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolve mainFields\n\n```js\nconfig.resolve.mainFields : ChainedSet\n\nconfig.resolve.mainFields\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolve mainFiles\n\n```js\nconfig.resolve.mainFiles : ChainedSet\n\nconfig.resolve.mainFiles\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n#### Config resolve exportsFields\n\n```js\nconfig.resolve.exportsFields : ChainedSet\n\nconfig.resolve.exportsFields\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n#### Config resolve importsFields\n\n```js\nconfig.resolve.importsFields : ChainedSet\n\nconfig.resolve.importsFields\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n#### Config resolve restrictions\n\n```js\nconfig.resolve.restrictions : ChainedSet\n\nconfig.resolve.restrictions\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n#### Config resolve roots\n\n```js\nconfig.resolve.roots : ChainedSet\n\nconfig.resolve.roots\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolve modules\n\n```js\nconfig.resolve.modules : ChainedSet\n\nconfig.resolve.modules\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n#### Config resolve plugin\n\n```js\nconfig.resolve\n  .plugin(name) : ChainedMap\n```\n\n#### Config resolve plugin: adding\n\n_NOTE: Do not use `new` to create the resolve plugin, as this will be done for you._\n\n```js\nconfig.resolve\n  .plugin(name)\n  .use(WebpackResolvePlugin, args)\n\n// Examples\n\nconfig.resolve\n  .plugin('resolve-css')\n  .use(ResolveCSSPlugin, [{ cssBasePath: true }])\n\n// Resolve plugins can also be specified by their path, allowing the expensive require()s to be\n// skipped in cases where the plugin or webpack configuration won't end up being used.\nconfig.resolve\n  .plugin('resolve-css')\n  .use(require.resolve('resolve-css-plugin'), [{ cssBasePath: true }])\n\n```\n\n#### Config resolve plugin: modify arguments\n\n```js\nconfig.resolve\n  .plugin(name)\n  .tap(args => newArgs)\n\n// Example\nconfig.resolve\n  .plugin('resolve-css')\n  .tap(args => [...args, { cssBasePath: false }])\n```\n\n#### Config resolve plugin: modify instantiation\n\n```js\nconfig.resolve\n  .plugin(name)\n  .init((Plugin, args) => new Plugin(...args));\n```\n\n#### Config resolve plugin: removing\n\n```js\nconfig.resolve.plugins.delete(name)\n```\n\n--- end\n#### Config resolve fallback\n\n```js\nconfig.resolve.fallback : ChainedMap\n\nconfig.resolve.fallback\n  .set(key, value)\n  .set(key, value)\n  .delete(key)\n  .clear()\n```\n\n#### Config resolve byDependency\n\n```js\nconfig.resolve.byDependency : ChainedMap\n\nconfig.resolve.byDependency\n  .set(key, value)\n  .set(key, value)\n  .delete(key)\n  .clear()\n```\n\n#### Config resolveLoader\n\nThe API for `config.resolveLoader` is identical to `config.resolve` with\nthe following additions:\n\n#### Config resolveLoader modules\n\n```js\nconfig.resolveLoader.modules : ChainedSet\n\nconfig.resolveLoader.modules\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolveLoader moduleExtensions\n\n```js\nconfig.resolveLoader.moduleExtensions : ChainedSet\n\nconfig.resolveLoader.moduleExtensions\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config resolveLoader packageMains\n\n```js\nconfig.resolveLoader.packageMains : ChainedSet\n\nconfig.resolveLoader.packageMains\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config performance: shorthand methods\n\n```js\nconfig.performance : ChainedValueMap\n\nconfig.performance(false)\n  .performance\n  .assetFilter(assetFilter)\n  .hints(hints)\n  .maxEntrypointSize(maxEntrypointSize)\n  .maxAssetSize(maxAssetSize)\n```\n\n#### Configuring optimizations: shorthand methods\n\n```js\nconfig.optimization : ChainedMap\n\nconfig.optimization\n  .minimize(minimize)\n  .runtimeChunk(runtimeChunk)\n  .emitOnErrors(emitOnErrors)\n  .moduleIds(moduleIds)\n  .chunkIds(chunkIds)\n  .nodeEnv(nodeEnv)\n  .mangleWasmImports(mangleWasmImports)\n  .removeAvailableModules(removeAvailableModules)\n  .removeEmptyChunks(removeEmptyChunks)\n  .mergeDuplicateChunks(mergeDuplicateChunks)\n  .flagIncludedChunks(flagIncludedChunks)\n  .providedExports(providedExports)\n  .usedExports(usedExports)\n  .concatenateModules(concatenateModules)\n  .sideEffects(sideEffects)\n  .portableRecords(portableRecords)\n  .mangleExports(mangleExports)\n  .innerGraph(innerGraph)\n  .realContentHash(realContentHash)\n```\n\n#### Config optimization minimizers\n\n```js\n// Backed at config.optimization.minimizers\nconfig.optimization\n  .minimizer(name) : ChainedMap\n```\n\n#### Config optimization minimizers: adding\n\n_NOTE: Do not use `new` to create the minimizer plugin, as this will be done for you._\n\n```js\nconfig.optimization\n  .minimizer(name)\n  .use(WebpackPlugin, args)\n\n// Examples\n\nconfig.optimization\n  .minimizer('css')\n  .use(OptimizeCSSAssetsPlugin, [{ cssProcessorOptions: { safe: true } }])\n\n// Minimizer plugins can also be specified by their path, allowing the expensive require()s to be\n// skipped in cases where the plugin or webpack configuration won't end up being used.\nconfig.optimization\n  .minimizer('css')\n  .use(require.resolve('optimize-css-assets-webpack-plugin'), [{ cssProcessorOptions: { safe: true } }])\n\n```\n\n#### Config optimization minimizers: modify arguments\n\n```js\nconfig.optimization\n  .minimizer(name)\n  .tap(args => newArgs)\n\n// Example\nconfig.optimization\n  .minimizer('css')\n  .tap(args => [...args, { cssProcessorOptions: { safe: false } }])\n```\n\n#### Config optimization minimizers: modify instantiation\n\n```js\nconfig.optimization\n  .minimizer(name)\n  .init((Plugin, args) => new Plugin(...args));\n```\n\n#### Config optimization minimizers: removing\n\n```js\nconfig.optimization.minimizers.delete(name)\n```\n#### Config optimization splitChunks\n\n```js\nconfig.optimization.splitChunks : ChainedValueMap\n\nconfig.optimization\n  .splitChunks({\n    chunks: all\n  }\n  .set(key, value)\n  .set(key, value)\n  .delete(key)\n  .clear()\n```\n\n#### Config plugins\n\n```js\n// Backed at config.plugins\nconfig.plugin(name) : ChainedMap\n```\n\n#### Config plugins: adding\n\n_NOTE: Do not use `new` to create the plugin, as this will be done for you._\n\n```js\nconfig\n  .plugin(name)\n  .use(WebpackPlugin, args)\n\n// Examples\n\nconfig\n  .plugin('hot')\n  .use(webpack.HotModuleReplacementPlugin);\n\n// Plugins can also be specified by their path, allowing the expensive require()s to be\n// skipped in cases where the plugin or webpack configuration won't end up being used.\nconfig\n  .plugin('env')\n  .use(require.resolve('webpack/lib/EnvironmentPlugin'), [{ 'VAR': false }]);\n```\n\n#### Config plugins: modify arguments\n\n```js\nconfig\n  .plugin(name)\n  .tap(args => newArgs)\n\n// Example\nconfig\n  .plugin('env')\n  .tap(args => [...args, 'SECRET_KEY']);\n```\n\n#### Config plugins: modify instantiation\n\n```js\nconfig\n  .plugin(name)\n  .init((Plugin, args) => new Plugin(...args));\n```\n\n#### Config plugins: removing\n\n```js\nconfig.plugins.delete(name)\n```\n\n#### Config plugins: ordering before\n\nSpecify that the current `plugin` context should operate before another named\n`plugin`. You cannot use both `.before()` and `.after()` on the same plugin.\n\n```js\nconfig\n  .plugin(name)\n    .before(otherName)\n\n// Example\n\nconfig\n  .plugin('html-template')\n    .use(HtmlWebpackTemplate)\n    .end()\n  .plugin('script-ext')\n    .use(ScriptExtWebpackPlugin)\n    .before('html-template');\n```\n\n#### Config plugins: ordering after\n\nSpecify that the current `plugin` context should operate after another named\n`plugin`. You cannot use both `.before()` and `.after()` on the same plugin.\n\n```js\nconfig\n  .plugin(name)\n    .after(otherName)\n\n// Example\n\nconfig\n  .plugin('html-template')\n    .after('script-ext')\n    .use(HtmlWebpackTemplate)\n    .end()\n  .plugin('script-ext')\n    .use(ScriptExtWebpackPlugin);\n```\n\n#### Config resolve plugins\n\n```js\n// Backed at config.resolve.plugins\nconfig.resolve.plugin(name) : ChainedMap\n```\n\n#### Config resolve plugins: adding\n\n_NOTE: Do not use `new` to create the plugin, as this will be done for you._\n\n```js\nconfig.resolve\n  .plugin(name)\n  .use(WebpackPlugin, args)\n```\n\n#### Config resolve plugins: modify arguments\n\n```js\nconfig.resolve\n  .plugin(name)\n  .tap(args => newArgs)\n```\n\n#### Config resolve plugins: modify instantiation\n\n```js\nconfig.resolve\n  .plugin(name)\n  .init((Plugin, args) => new Plugin(...args))\n```\n\n#### Config resolve plugins: removing\n\n```js\nconfig.resolve.plugins.delete(name)\n```\n\n#### Config resolve plugins: ordering before\n\nSpecify that the current `plugin` context should operate before another named\n`plugin`. You cannot use both `.before()` and `.after()` on the same resolve\nplugin.\n\n```js\nconfig.resolve\n  .plugin(name)\n    .before(otherName)\n\n// Example\n\nconfig.resolve\n  .plugin('beta')\n    .use(BetaWebpackPlugin)\n    .end()\n  .plugin('alpha')\n    .use(AlphaWebpackPlugin)\n    .before('beta');\n```\n\n#### Config resolve plugins: ordering after\n\nSpecify that the current `plugin` context should operate after another named\n`plugin`. You cannot use both `.before()` and `.after()` on the same resolve\nplugin.\n\n```js\nconfig.resolve\n  .plugin(name)\n    .after(otherName)\n\n// Example\n\nconfig.resolve\n  .plugin('beta')\n    .after('alpha')\n    .use(BetaWebpackTemplate)\n    .end()\n  .plugin('alpha')\n    .use(AlphaWebpackPlugin);\n```\n\n#### Config node\n\n```js\nconfig.node : ChainedValueMap\n\nconfig.node(false)\n  .node\n  .set('__dirname', 'mock')\n  .set('__filename', 'mock');\n```\n\n#### Config devServer\n\n```js\nconfig.devServer : ChainedMap\n```\n\n#### Config devServer allowedHosts\n\n```js\nconfig.devServer.allowedHosts : ChainedSet\n\nconfig.devServer.allowedHosts\n  .add(value)\n  .prepend(value)\n  .clear()\n```\n\n#### Config devServer: shorthand methods\n\n```js\nconfig.devServer\n  .after(after)\n  .before(before)\n  .bonjour(bonjour)\n  .clientLogLevel(clientLogLevel)\n  .compress(compress)\n  .contentBase(contentBase)\n  .contentBasePublicPath(contentBasePublicPath)\n  .disableHostCheck(disableHostCheck)\n  .filename(filename)\n  .headers(headers)\n  .historyApiFallback(historyApiFallback)\n  .host(host)\n  .hot(hot)\n  .hotOnly(hotOnly)\n  .http2(http2)\n  .https(https)\n  .index(index)\n  .injectClient(injectClient)\n  .injectHot(injectHot)\n  .inline(inline)\n  .lazy(lazy)\n  .liveReload(liveReload)\n  .mimeTypes(mimeTypes)\n  .noInfo(noInfo)\n  .onListening(onListening)\n  .open(open)\n  .openPage(openPage)\n  .overlay(overlay)\n  .pfx(pfx)\n  .pfxPassphrase(pfxPassphrase)\n  .port(port)\n  .progress(progress)\n  .proxy(proxy)\n  .public(public)\n  .publicPath(publicPath)\n  .quiet(quiet)\n  .serveIndex(serveIndex)\n  .setup(setup)\n  .socket(socket)\n  .sockHost(sockHost)\n  .sockPath(sockPath)\n  .sockPort(sockPort)\n  .staticOptions(staticOptions)\n  .stats(stats)\n  .stdin(stdin)\n  .transportMode(transportMode)\n  .useLocalIp(useLocalIp)\n  .watchContentBase(watchContentBase)\n  .watchOptions(watchOptions)\n  .writeToDisk(writeToDisk)\n```\n\n#### Config module\n\n```js\nconfig.module : ChainedMap\n```\n\n#### Config module: shorthand methods\n\n```js\nconfig.module : ChainedMap\n\nconfig.module\n  .noParse(noParse)\n  .unsafeCache(unsafeCache)\n  .wrappedContextCritical(wrappedContextCritical)\n  .exprContextRegExp(exprContextRegExp)\n  .wrappedContextRecursive(wrappedContextRecursive)\n  .strictExportPresence(strictExportPresence)\n  .wrappedContextRegExp(wrappedContextRegExp)\n```\n\n#### Config module rules: shorthand methods\n\n```js\nconfig.module.rules : ChainedMap\n\nconfig.module\n  .rule(name)\n    .test(test)\n    .pre()\n    .post()\n    .enforce(preOrPost)\n```\n\n#### Config module rules uses (loaders): creating\n\n```js\nconfig.module.rules{}.uses : ChainedMap\n\nconfig.module\n  .rule(name)\n    .use(name)\n      .loader(loader)\n      .options(options)\n\n// Example\n\nconfig.module\n  .rule('compile')\n    .use('babel')\n      .loader('babel-loader')\n      .options({ presets: ['@babel/preset-env'] });\n```\n\n#### Config module rules uses (loaders): modifying options\n\n```js\nconfig.module\n  .rule(name)\n    .use(name)\n      .tap(options => newOptions)\n\n// Example\n\nconfig.module\n  .rule('compile')\n    .use('babel')\n      .tap(options => merge(options, {\n        plugins: ['@babel/plugin-proposal-class-properties']\n      }));\n```\n\n#### Config module rules nested rules:\n\n```js\nconfig.module.rules{}.rules : ChainedMap<Rule>\n\nconfig.module\n  .rule(name)\n    .rule(name)\n\n// Example\n\nconfig.module\n  .rule('css')\n    .test(/\\.css$/)\n    .use('style')\n      .loader('style-loader')\n      .end()\n    .rule('postcss')\n      .resourceQuery(/postcss/)\n      .use('postcss')\n        .loader('postcss-loader')\n```\n\n#### Config module rules nested rules: ordering before\nSpecify that the current `rule` context should operate before another named\n`rule`. You cannot use both `.before()` and `.after()` on the same `rule`.\n\n```js\nconfig.module.rules{}.rules : ChainedMap<Rule>\n\nconfig.module\n  .rule(name)\n    .rule(name)\n      .before(otherName)\n\n// Example\n\nconfig.module\n  .rule('css')\n    .use('style')\n      .loader('style-loader')\n      .end()\n    .rule('postcss')\n      .resourceQuery(/postcss/)\n      .use('postcss')\n        .loader('postcss-loader')\n        .end()\n      .end()\n    .rule('css-loader')\n      .resourceQuery(/css-loader/)\n      .before('postcss')\n      .use('css-loader')\n        .loader('css-loader')\n```\n\n#### Config module rules nested rules: ordering after\nSpecify that the current `rule` context should operate after another named\n`rule`. You cannot use both `.before()` and `.after()` on the same `rule`.\n\n```js\nconfig.module.rules{}.rules : ChainedMap<Rule>\n\nconfig.module\n  .rule(name)\n    .rule(name)\n      .after(otherName)\n\n// Example\n\nconfig.module\n  .rule('css')\n    .use('style')\n      .loader('style-loader')\n      .end()\n    .rule('postcss')\n      .resourceQuery(/postcss/)\n      .after('css-loader')\n      .use('postcss')\n        .loader('postcss-loader')\n        .end()\n      .end()\n    .rule('css-loader')\n      .resourceQuery(/css-loader/)\n      .use('css-loader')\n        .loader('css-loader')\n```\n\n#### Config module rules oneOfs (conditional rules):\n\n```js\nconfig.module.rules{}.oneOfs : ChainedMap<Rule>\n\nconfig.module\n  .rule(name)\n    .oneOf(name)\n\n// Example\n\nconfig.module\n  .rule('css')\n    .oneOf('inline')\n      .resourceQuery(/inline/)\n      .use('url')\n        .loader('url-loader')\n        .end()\n      .end()\n    .oneOf('external')\n      .resourceQuery(/external/)\n      .use('file')\n        .loader('file-loader')\n```\n\n#### Config module rules oneOfs (conditional rules): ordering before\nSpecify that the current `oneOf` context should operate before another named\n`oneOf`. You cannot use both `.before()` and `.after()` on the same `oneOf`.\n\n```js\nconfig.module\n  .rule(name)\n    .oneOf(name)\n      .before()\n\n// Example\n\nconfig.module\n  .rule('scss')\n    .test(/\\.scss$/)\n    .oneOf('normal')\n      .use('sass')\n        .loader('sass-loader')\n        .end()\n      .end()\n    .oneOf('sass-vars')\n      .before('normal')\n      .resourceQuery(/\\?sassvars/)\n      .use('sass-vars')\n        .loader('sass-vars-to-js-loader')\n```\n\n#### Config module rules oneOfs (conditional rules): ordering after\nSpecify that the current `oneOf` context should operate after another named\n`oneOf`. You cannot use both `.before()` and `.after()` on the same `oneOf`.\n\n```js\nconfig.module\n  .rule(name)\n    .oneOf(name)\n      .after()\n\n// Example\n\nconfig.module\n  .rule('scss')\n    .test(/\\.scss$/)\n    .oneOf('vue')\n      .resourceQuery(/\\?vue/)\n      .use('vue-style')\n        .loader('vue-style-loader')\n        .end()\n      .end()\n    .oneOf('normal')\n      .use('sass')\n        .loader('sass-loader')\n        .end()\n      .end()\n    .oneOf('sass-vars')\n      .after('vue')\n      .resourceQuery(/\\?sassvars/)\n      .use('sass-vars')\n        .loader('sass-vars-to-js-loader')\n```\n\n#### Config module rules resolve\n\nSpecify a resolve configuration to be merged over the default `config.resolve`\nfor modules that match the rule.\n\nSee \"Config resolve\" sections above for full syntax.\n\n**Note:** This option is supported by webpack since 4.36.1.\n\n```js\nconfig.module\n  .rule(name)\n    .resolve\n\n// Example\n\nconfig.module\n  .rule('scss')\n    .test(/\\.scss$/)\n    .resolve\n      .symlinks(true)\n```\n\n---\n\n### Merging Config\n\nwebpack-chain supports merging in an object to the configuration instance which\nmatches a layout similar to how the webpack-chain schema is laid out.\n\n**Note:** This object does not match the webpack configuration schema exactly\n(for example the `[name]` keys for entry/rules/plugins), so you may need to transform\nwebpack configuration objects (such as those output by webpack-chain's `.toConfig()`)\nto match the layout below prior to passing to `.merge()`.\n\n```js\nconfig.merge({ devtool: 'source-map' });\n\nconfig.get('devtool') // \"source-map\"\n```\n\n```js\nconfig.merge({\n  [key]: value,\n\n  amd,\n  bail,\n  cache,\n  context,\n  devtool,\n  externals,\n  loader,\n  mode,\n  parallelism,\n  profile,\n  recordsPath,\n  recordsInputPath,\n  recordsOutputPath,\n  stats,\n  target,\n  watch,\n  watchOptions,\n\n  entry: {\n    [name]: [...values]\n  },\n\n  plugin: {\n    [name]: {\n      plugin: WebpackPlugin,\n      args: [...args],\n      before,\n      after\n    }\n  },\n\n  devServer: {\n    [key]: value,\n\n    clientLogLevel,\n    compress,\n    contentBase,\n    filename,\n    headers,\n    historyApiFallback,\n    host,\n    hot,\n    hotOnly,\n    https,\n    inline,\n    lazy,\n    noInfo,\n    overlay,\n    port,\n    proxy,\n    quiet,\n    setup,\n    stats,\n    watchContentBase\n  },\n\n  node: {\n    [key]: value\n  },\n\n  optimization: {\n    concatenateModules,\n    flagIncludedChunks,\n    mergeDuplicateChunks,\n    minimize,\n    minimizer: {\n      [name]: {\n        plugin: WebpackPlugin,\n        args: [...args],\n        before,\n        after\n      }\n    },\n    namedChunks,\n    namedModules,\n    nodeEnv,\n    noEmitOnErrors,\n    occurrenceOrder,\n    portableRecords,\n    providedExports,\n    removeAvailableModules,\n    removeEmptyChunks,\n    runtimeChunk,\n    sideEffects,\n    splitChunks,\n    usedExports,\n  },\n\n  performance: {\n    [key]: value,\n\n    hints,\n    maxEntrypointSize,\n    maxAssetSize,\n    assetFilter\n  },\n\n  resolve: {\n    [key]: value,\n\n    alias: {\n      [key]: value\n    },\n    aliasFields: [...values],\n    descriptionFields: [...values],\n    extensions: [...values],\n    mainFields: [...values],\n    mainFiles: [...values],\n    modules: [...values],\n\n    plugin: {\n      [name]: {\n        plugin: WebpackPlugin,\n        args: [...args],\n        before,\n        after\n      }\n    }\n  },\n\n  resolveLoader: {\n    [key]: value,\n\n    alias: {\n      [key]: value\n    },\n    aliasFields: [...values],\n    descriptionFields: [...values],\n    extensions: [...values],\n    mainFields: [...values],\n    mainFiles: [...values],\n    modules: [...values],\n    moduleExtensions: [...values],\n    packageMains: [...values],\n\n    plugin: {\n      [name]: {\n        plugin: WebpackPlugin,\n        args: [...args],\n        before,\n        after\n      }\n    }\n  },\n\n  module: {\n    [key]: value,\n\n    rule: {\n      [name]: {\n        [key]: value,\n\n        enforce,\n        issuer,\n        parser,\n        resource,\n        resourceQuery,\n        test,\n\n        include: [...paths],\n        exclude: [...paths],\n\n        rules: {\n          [name]: Rule\n        },\n\n        oneOf: {\n          [name]: Rule\n        },\n\n        use: {\n          [name]: {\n            loader: LoaderString,\n            options: LoaderOptions,\n            before,\n            after\n          }\n        }\n      }\n    }\n  }\n})\n```\n\n### Conditional configuration\n\nWhen working with instances of `ChainedMap` and `ChainedSet`, you can perform\nconditional configuration using `when`. You must specify an expression to\n`when()` which will be evaluated for truthiness or falsiness. If the expression\nis truthy, the first function argument will be invoked with an instance of the\ncurrent chained instance. You can optionally provide a second function to be\ninvoked when the condition is falsy, which is also given the current chained\ninstance.\n\n```js\n// Example: Only add minify plugin during production\nconfig\n  .when(process.env.NODE_ENV === 'production', config => {\n    config\n      .plugin('minify')\n      .use(BabiliWebpackPlugin);\n  });\n```\n\n```js\n// Example: Only add minify plugin during production,\n// otherwise set devtool to source-map\nconfig\n  .when(process.env.NODE_ENV === 'production',\n    config => config.plugin('minify').use(BabiliWebpackPlugin),\n    config => config.devtool('source-map')\n  );\n```\n\n### Inspecting generated configuration\n\nYou can inspect the generated webpack config using `config.toString()`. This\nwill generate a stringified version of the config with comment hints for named\nrules, uses and plugins:\n\n```js\nconfig\n  .module\n    .rule('compile')\n      .test(/\\.js$/)\n      .use('babel')\n        .loader('babel-loader');\n\nconfig.toString();\n\n/*\n{\n  module: {\n    rules: [\n      /* config.module.rule('compile') */\n      {\n        test: /\\.js$/,\n        use: [\n          /* config.module.rule('compile').use('babel') */\n          {\n            loader: 'babel-loader'\n          }\n        ]\n      }\n    ]\n  }\n}\n*/\n```\n\nBy default the generated string cannot be used directly as real webpack config\nif it contains objects and plugins that need to be required. In order to\ngenerate usable config, you can customize how objects and plugins are\nstringified by setting a special `__expression` property on them:\n\n```js\nconst sass = require('sass');\nsass.__expression = `require('sass')`;\n\nclass MyPlugin {}\nMyPlugin.__expression = `require('my-plugin')`;\n\nfunction myFunction () {}\nmyFunction.__expression = `require('my-function')`;\n\nconfig\n  .plugin('example')\n    .use(MyPlugin, [{ fn: myFunction, implementation: sass, }]);\n\nconfig.toString();\n\n/*\n{\n  plugins: [\n    new (require('my-plugin'))({\n      fn: require('my-function'),\n      implementation: require('sass')\n    })\n  ]\n}\n*/\n```\n\nPlugins specified via their path will have their `require()` statement generated\nautomatically:\n\n```js\nconfig\n  .plugin('env')\n    .use(require.resolve('webpack/lib/ProvidePlugin'), [{ jQuery: 'jquery' }])\n\nconfig.toString();\n\n/*\n{\n  plugins: [\n    new (require('/foo/bar/src/node_modules/webpack/lib/EnvironmentPlugin.js'))(\n      {\n        jQuery: 'jquery'\n      }\n    )\n  ]\n}\n*/\n```\n\nYou can also call `toString` as a static method on `Config` in order to\nmodify the configuration object prior to stringifying.\n\n```js\nConfig.toString({\n  ...config.toConfig(),\n  module: {\n    defaultRules: [\n      {\n        use: [\n          {\n            loader: 'banner-loader',\n            options: { prefix: 'banner-prefix.txt' },\n          },\n        ],\n      },\n    ],\n  },\n})\n```\n\n```\n{\n  plugins: [\n    /* config.plugin('foo') */\n    new TestPlugin()\n  ],\n  module: {\n    defaultRules: [\n      {\n        use: [\n          {\n            loader: 'banner-loader',\n            options: {\n              prefix: 'banner-prefix.txt'\n            }\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n[npm-image]: https://img.shields.io/npm/v/webpack-chain.svg\n[npm-downloads]: https://img.shields.io/npm/dt/webpack-chain.svg\n[npm-url]: https://www.npmjs.com/package/webpack-chain\n[ci-image]: https://github.com/neutrinojs/webpack-chain/actions/workflows/ci.yml/badge.svg\n[ci-url]: https://github.com/neutrinojs/webpack-chain/actions/workflows/ci.yml\n","_attachments":{},"homepage":"https://github.com/sorrycc/webpack-chain#readme","bugs":{"url":"https://github.com/sorrycc/webpack-chain/issues"},"license":"MPL-2.0"}