{"_id":"@alyzenpublic/craco","_rev":"2-14bf2d134916dd9a30b7df3fe3d9b6d9","name":"@alyzenpublic/craco","dist-tags":{"latest":"3.2.3-dev2"},"versions":{"3.2.3-dev":{"name":"@alyzenpublic/craco","description":"Create React App Configuration Override, an easy and comprehensible configuration layer for create-react-app v2.","scripts":{},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/sharegate/craco.git"},"keywords":["react","create-react-app","cra"],"author":{"name":"Groupe Sharegate inc."},"license":"Apache-2.0","bugs":{"url":"https://github.com/sharegate/craco/issues"},"homepage":"https://github.com/sharegate/craco","engines":{"node":">=6"},"bin":{"craco":"./bin/craco.js"},"peerDependencies":{"react-scripts":"*"},"devDependencies":{"react-scripts":"2.1.1"},"dependencies":{"cross-spawn":"6.0.5","lodash.mergewith":"4.6.1","webpack-merge":"4.1.4"},"version":"3.2.3-dev","gitHead":"c4e8dd40aa875fcef02467dac444122bbf241956","_resolved":"","_integrity":"","_from":"file:alyzenpublic-craco-v3.2.3-dev.tgz","_id":"@alyzenpublic/craco@3.2.3-dev","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"ehardesty","email":"ehardesty@alyzenmed.com"},"dist":{"integrity":"sha512-yUGKp65RObAspQjaZVD7uU7TCQg7s7TgwZK/jTjDE7XUjESBjNZmvb5Aamc/XZR2W0pStOTL6w0eQ/yEBpcpjA==","shasum":"4d71c722116260e99f67f9875328bfa27baab0d6","tarball":"https://registry.npmjs.org/@alyzenpublic/craco/-/craco-3.2.3-dev.tgz","fileCount":7,"unpackedSize":2041,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJqrXCRA9TVsSAnZWagAAdEMQAJvIU11uy8BEILf9cVI1\nXIaBREaoaesCpmTL8Aiq8dx41LRLKe76GLFY1IODUBVUlzAo61MCjXbpKIrr\n4Vwb2Xqpw+yq8s+xRyWWNhE6R03zbncCKlNl1VUO9k/AnwV3U4EyrQHLFMrp\nQ9GxHJ13V97GqIl81E6KEGHfz78gHxeXAtY6n80KQsKmTSdSPOJ3GwORUzn0\nsNtTi95d+QPjUGvWipSuboVxeOR1HUCp4PXJ+G6/5LrKsl/O+uQvndr7jWm5\nWYrcKVwh2hNxaNQ85xrC+73eCyLgE5ZtDBE8e6R31zJQESS6yad1nozq/e0Q\nU96BdkepQEr/SFr0lw/JWPAiH8p1DXEORLS85xAfb7fHfLUmEy1+1hbzpqdl\nJkdZYzwzxGGCB0PsrVFq+6XYLTnjUCZWv+prismLPfTR2Xueb5yTE1/Y32E8\nVGGx9vDGrzraEEBqQDNfhkR/ST4UH0vgr22yw93ixWvUE2bsi+BFnSaaMA6u\ncDEq+p9en230RrrJBGseIo4/POJrpUz8NmijQQJtqU6jm5Cvo327w/QoHbcj\nB8zHLCUwKCv2ZWacuU7wGvHhQMf78aJrRIQ/vuoVhGYT9z0zicrevzF09ZMJ\n2/RPXyoNqjSBAfX1NXqMi7n9WbuCPmzyCurmP/C+dAJKiRiy1rxYryvjpN0W\nWKA/\r\n=sLAD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjYsdO1GGJjaJqEPfklZALXX+F9kqAKZqdM4kiqRczIAiEApo7gI/LHVHNZD5txlI7DoBAWeGZ9uXe9dw7InAwq7uY="}]},"maintainers":[{"name":"spencer.alyzen","email":"sdavis@alyzenmed.com"},{"name":"ehardesty","email":"ehardesty@alyzenmed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/craco_3.2.3-dev_1546037974379_0.17155449461265126"},"_hasShrinkwrap":false},"3.2.3-dev2":{"name":"@alyzenpublic/craco","description":"Create React App Configuration Override, an easy and comprehensible configuration layer for create-react-app v2.","scripts":{},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/sharegate/craco.git"},"keywords":["react","create-react-app","cra"],"author":{"name":"Groupe Sharegate inc."},"license":"Apache-2.0","bugs":{"url":"https://github.com/sharegate/craco/issues"},"homepage":"https://github.com/sharegate/craco","engines":{"node":">=6"},"bin":{"craco":"./bin/craco.js"},"peerDependencies":{"react-scripts":"*"},"devDependencies":{"react-scripts":"2.1.1"},"dependencies":{"cross-spawn":"6.0.5","lodash.mergewith":"4.6.1","webpack-merge":"4.1.4"},"version":"3.2.3-dev2","gitHead":"c4e8dd40aa875fcef02467dac444122bbf241956","_resolved":"","_integrity":"","_from":"file:alyzenpublic-craco-3.2.3-dev2.tgz","_id":"@alyzenpublic/craco@3.2.3-dev2","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"ehardesty","email":"ehardesty@alyzenmed.com"},"dist":{"integrity":"sha512-CUAPY9LYOD/9EEgMv2n6YEaxumGfJgZ0hjgcdyemFE9/9Iqz/tyKiD27XRzvRtAnRpalpRY1hY3xdPfbaoBRKA==","shasum":"cefc237f328dd75189e8933353c902b6a8367f0f","tarball":"https://registry.npmjs.org/@alyzenpublic/craco/-/craco-3.2.3-dev2.tgz","fileCount":30,"unpackedSize":80696,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJq0ACRA9TVsSAnZWagAAmCQP+QHjWUxCSuzuBe+6R0br\nF5IdO0EQH3A4m/9JJq0f6JlwneX9FIpAb51R5109JvoDjwmAdZXv4Ys0WWs/\nOr/0JdtV1KcGWp/cJ9frZjRasQIJayi9f3of9Ik68gBcUFw3/LrUlLOiMgwD\nexPcS7cYMEDK1dkQ9+yzjH+ucFh+iauwgcYTojNgbeBvbRp4GFSQwAPrVwjf\nzJFRSYnoxLlZIui7RrpNGSezDIXjMBYggHEHFzBV+FG/a/rZX1LaTIDBFb+d\niSoH9ZrTROy88LMrXohuOOJvvlqMDieU6GoB2S4J57JR8t3qElMI1symSkhU\nWcUBoITpR73IWzU94NxST6jX2vXSj9HGDVJK/UJM0pvgEMuDS/PqG6ZM3DO+\nyalek0fKvpiH9hTuNDVnPXH2tq00LSKFqqnomLAd6Rykw1Gih/NS4k2OTjLG\nt36HNOScrViNWovDIqkKaAEQTwp+ErX7dHRUJVAIaU3/QY6atf6vyd5urH7o\nWJlmzhe1fvJibYepvz3L0ihFV4Hj3dsCL+LlZ0t5OKA5/lqaJm3lATOGlPEF\nF/WF5iwMGtsPNTOf1CTKni7GGCCu0s77zlQwHSgLxzMKDLNTenun1QnQlb75\nBph2+1l8JCuTDf86Rg2/Q9GXWsmdkozVNd2W3M4jM6TjIdGiSbrh6nTvJcoL\nOsJp\r\n=Bspi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHTA0361JEt3QitJfT0bfPtZyPpvX6Jqs+BAxRxbLmFlAiBi7205Q5+M/fI7SYgV+sKYVB6/8gFlpmvqKtwR3QWJtA=="}]},"maintainers":[{"name":"ehardesty","email":"ehardesty@alyzenmed.com"},{"name":"spencer.alyzen","email":"sdavis@alyzenmed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/craco_3.2.3-dev2_1546038528306_0.9159497402753176"},"_hasShrinkwrap":false}},"time":{"created":"2018-12-28T22:59:34.188Z","3.2.3-dev":"2018-12-28T22:59:34.514Z","modified":"2022-04-04T13:42:23.525Z","3.2.3-dev2":"2018-12-28T23:08:48.434Z"},"maintainers":[{"name":"ehardesty","email":"ehardesty@alyzenmed.com"},{"name":"spencer.alyzen","email":"sdavis@alyzenmed.com"}],"description":"Create React App Configuration Override, an easy and comprehensible configuration layer for create-react-app v2.","homepage":"https://github.com/sharegate/craco","keywords":["react","create-react-app","cra"],"repository":{"type":"git","url":"git+https://github.com/sharegate/craco.git"},"author":{"name":"Groupe Sharegate inc."},"bugs":{"url":"https://github.com/sharegate/craco/issues"},"license":"Apache-2.0","readme":"# craco [![Build Status](https://travis-ci.org/sharegate/craco.svg?branch=master)](https://travis-ci.org/sharegate/craco) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/sharegate/craco/pulls)\n\n**C**reate **R**eact **A**pp **C**onfiguration **O**verride is an easy and comprehensible configuration layer for create-react-app v2.\n\nGet all the benefits of create-react-app **and** customization without using 'eject' by adding a single `craco.config.js` file at the root of your application and customize your eslint, babel, postcss configurations and many more.\n\nAll you have to do is create your app using [create-react-app](https://github.com/facebook/create-react-app/) and customize the configuration with a `craco.config.js` file.\n\n- [CLI Options](#cli-options) - Available CLI options.\n- [Configuration Overview](#configuration-overview) - Quickly see how you can configure your CRA installation with this plugin.\n- [Recipes](https://github.com/sharegate/craco/tree/master/recipes) – Short recipes for common use cases.\n- [Available Plugins](https://github.com/sharegate/craco#community-maintained-plugins) - Plugins maintained by the community.\n- [Develop a Plugin](#develop-a-plugin) - How to develop a plugin for `craco`.\n- [Changelog](https://github.com/sharegate/craco/tree/master/changelog) - List of major changes\n\n**Acknowledgements:**\n\nWe are grateful to [@timarney](https://github.com/timarney) the creator of [react-app-rewired](https://github.com/timarney/react-app-rewired) for his original idea.\n\nAlso, please note that the configuration style of this plugin has been greatly influenced by the way [Vue CLI](https://cli.vuejs.org/guide/) does it.\n\n**Please Note:**\n\nBy doing this you're breaking the [\"guarantees\"](https://github.com/facebookincubator/create-react-app/issues/99#issuecomment-234657710) that CRA provides. That is to say you now \"own\" the configs. **No support** will be provided. Proceed with caution.\n\n## You updated craco and everything falls apart\n\nBefore logging an issue, please consult the [changelog](https://github.com/sharegate/craco/tree/master/changelog).\n\nIf you can't find a solution to your problem in the changelog, log an issue and someone should help you quickly!\n\n## Installation\n\nInstall the plugin from **npm**:\n\n```bash\n$ yarn add @craco/craco\n\n# OR\n\n$ npm install @craco/craco --save\n```\n\nCreate a `craco.config.js` file in the root directory:\n\n```\nmy-app\n├── node_modules\n├── craco.config.js\n└── package.json\n```\n\nExport your configuration as an **object literal**:\n\n```javascript\n/* craco.config.js */\n\nmodule.exports = {\n    ...\n}\n```\n\nor a **function**:\n\n```javascript\n/* craco.config.js */\n\nmodule.exports = function({ env, paths }) {\n    return {\n        ...\n    };\n}\n```\n\nUpdate the existing calls to `react-scripts` in the `scripts` section of your `package.json` file to use the `craco` CLI:\n\n```diff\n/* package.json */\n\n\"scripts\": {\n-   \"start\": \"react-scripts start\",\n+   \"start\": \"craco start\",\n-   \"build\": \"react-scripts build\",\n+   \"build\": \"craco build\"\n-   \"test\": \"react-scripts test\",\n+   \"test\": \"craco test\"\n}\n```\n\nStart your app for development:\n\n```bash\n$ npm start\n```\n\nOr build your app:\n\n```bash\n$ npm run build\n```\n\n## CLI Options\n\nWhen you execute `craco start` or `craco build` a few options are available.\n\nTo change the location of the configuration file:\n\n```javascript\n\"scripts\": {\n    \"start\": \"craco start --config config/craco-config-with-custom-name.js\"\n}\n```\n\nTo use with a **yarn workspace** or any **monorepo setup** that follows the popular convention `packages/*`:\n\n```javascript\n\"scripts\": {\n    \"start\": \"craco start --workspace\"\n}\n```\n\nTo use with a different version of `react-scripts`:\n\n```javascript\n\"scripts\": {\n    \"start\": \"craco start --scripts-version react-scripts-ts\"\n}\n```\n\nTo provided a custom path for the `react-scripts` folder:\n\n```javascript\n\"scripts\": {\n    \"start\": \"craco start --react-scripts ../../react-scripts-with-custom-name\"\n}\n```\n\n_The provided `react-scripts` folder path must be relative to the current working directory._\n\n_If `--react-scripts` is provided, `--workspace` and `--scripts-version` will be ignored._\n\nTo activate **verbose** logging:\n\n```javascript\n\"scripts\": {\n    \"start\": \"craco start --verbose\"\n}\n```\n\n## Configuration Overview\n\nWhen the property **mode** is available there are 2 possible values:\n- `extends`: the provided configuration will extends the CRA settings (**default mode**)\n- `file`: the CRA settings will be reseted and you will provide an official configuration file for the plugin ([postcss](https://github.com/michael-ciniawsky/postcss-load-config#postcssrc), [eslint](https://eslint.org/docs/user-guide/configuring#configuration-file-formats)) that will supersede any settings.\n\n```javascript\nconst { paths, when, whenDev, whenProd, whenTest, ESLINT_MODES, POSTCSS_MODES } = require(\"@craco/craco\");\n\nmodule.exports = {\n    style: {\n        modules: {\n            localIdentName: \"\"\n        },\n        css: {\n            loaderOptions: { /* Any css-loader configuration options: https://github.com/webpack-contrib/css-loader. */ },\n            loaderOptions: (cssLoaderOptions, { env, paths }) => { return cssLoaderOptions; }\n        },\n        sass: {\n            loaderOptions: { /* Any sass-loader configuration options: https://github.com/webpack-contrib/sass-loader. */ },\n            loaderOptions: (sassLoaderOptions, { env, paths }) => { return sassLoaderOptions; }\n        },\n        postcss: {\n            mode: \"extends\" /* (default value) */ || \"file\",\n            plugins: [],\n            env: {\n                autoprefixer: { /* Any autoprefixer options: https://github.com/postcss/autoprefixer#options */ },\n                stage: 3, /* Any valid stages: https://cssdb.org/#staging-process. */\n                features: { /* Any CSS features: https://preset-env.cssdb.org/features. */ }\n            },\n            loaderOptions: { /* Any postcss-loader configuration options: https://github.com/postcss/postcss-loader. */ },\n            loaderOptions: (postcssLoaderOptions, { env, paths }) => { return postcssLoaderOptions; }\n        }\n    },\n    eslint: {\n        enable: true,\n        mode: \"extends\" /* (default value) */ || \"file\",\n        configure: { /* Any eslint configuration options: https://eslint.org/docs/user-guide/configuring */ },\n        configure: (eslintConfig, { env, paths }) => { return eslintConfig; },\n        loaderOptions: { /* Any eslint-loader configuration options: https://github.com/webpack-contrib/eslint-loader. */ },\n        loaderOptions: (eslintOptions, { env, paths }) => { return eslintOptions; }\n    },\n    babel: {\n        presets: [],\n        plugins: [],\n        loaderOptions: { /* Any babel-loader configuration options: https://github.com/babel/babel-loader. */ },\n        loaderOptions: (babelLoaderOptions, { env, paths }) => { return babelLoaderOptions; }\n    },\n    webpack: {\n        alias: {},\n        plugins: [],\n        configure: { /* Any webpack configuration options: https://webpack.js.org/configuration */ },\n        configure: (webpackConfig, { env, paths }) => { return webpackConfig; }\n    },\n    jest: {\n        babel: {\n            addPresets: true, // (default value)\n            addPlugins: true  // (default value)\n        },\n        configure: { /* Any Jest configuration options: https://jestjs.io/docs/en/configuration. */ },\n        configure: (jestConfig, { env, paths, resolve, rootDir }) => { return jestConfig; }\n    },\n    devServer: { /* Any devServer configuration options: https://webpack.js.org/configuration/dev-server/#devserver. */ },\n    devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => { return devServerConfig; },\n    plugins: [\n        {\n            plugin: {\n                overrideCracoConfig: ({ cracoConfig, pluginOptions, context: { env, paths } }) => { return cracoConfig; },\n                overrideWebpackConfig: ({ webpackConfig, cracoConfig, pluginOptions, context: { env, paths } }) => { return webpackConfig; },\n                overrideJestConfig: ({ jestConfig, cracoConfig, pluginOptions, context: { env, paths, resolve, rootDir } }) => { return jestConfig };\n            },\n            options: {}\n        }\n    ]\n};\n```\n\n## Develop a plugin\n\nThere are 3 functions available to a plugin:\n- `overrideCracoConfig`: Let a plugin customize the config object before it's process by `craco`.\n- `overrideWebpackConfig`: Let a plugin customize the `webpack` config that will be used by CRA.\n- `overrideJestConfig`: Let a plugin customize the `Jest` config that will be used by CRA.\n\n**Important:**\n\nEvery functions must return the updated config object.\n\n### overrideCracoConfig\n\nThe function `overrideCracoConfig` let a plugin override the config object **before** it's process by `craco`.\n\nIf a plugin define the function, it will be called with the config object read from the `craco.config.js` file provided by the consumer.\n\n*The function must return a valid config object, otherwise `craco` will throw an error.*\n\nThe function will be called with a single object argument having the following structure:\n\n```javascript\n{\n    cracoConfig: \"The config object read from the craco.config.js file provided by the consumer\",\n    pluginOptions: \"The plugin options provided by the consumer\",\n    context: {\n        env: \"The current NODE_ENV (development, production, etc..)\",\n        paths: \"An object that contains all the paths used by CRA\"\n    }\n}\n```\n\n#### Example\n\nPlugin:\n\n```javascript\n/* craco-plugin-log-craco-config.js */\n\nmodule.exports = {\n    overrideCracoConfig: ({ cracoConfig, pluginOptions, context: { env, paths } }) => {\n        if (pluginOptions.preText) {\n            console.log(pluginOptions.preText);\n        }\n\n        console.log(JSON.stringify(craconfig, null, 4));\n\n        // Always return the config object.\n        return cracoConfig;\n    }\n};\n```\n\nRegistration (in a `craco.config.js` file):\n\n```javascript\nconst logCracoConfigPlugin = require(\"./craco-plugin-log-craco-config\");\n\nmodule.exports = {\n    ...\n    plugins: [\n        { plugin: logCracoConfigPlugin, options: { preText: \"Will log the craco config:\" } }\n    ]\n};\n```\n\n### overrideWebpackConfig\n\nThe function `overrideWebpackConfig` let a plugin override the `webpack` config object **after** it's been customized by `craco`.\n\n*The function must return a valid config object, otherwise `craco` will throw an error.*\n\nThe function will be called with a single object argument having the following structure:\n\n```javascript\n{\n    webpackConfig: \"The webpack config object already customized by craco\",\n    cracoConfig: \"The configuration object read from the craco.config.js file provided by the consumer\",\n    pluginOptions: \"The plugin options provided by the consumer\",\n    context: {\n        env: \"The current NODE_ENV (development, production, etc..)\",\n        paths: \"An object that contains all the paths used by CRA\"\n    }\n}\n```\n\n#### Example\n\nPlugin:\n\n```javascript\n/* craco-plugin-log-webpack-config.js */\n\nmodule.exports = {\n    overrideWebpackConfig: ({ webpackConfig, cracoConfig, pluginOptions, context: { env, paths } }) => {\n        if (pluginOptions.preText) {\n            console.log(pluginOptions.preText);\n        }\n\n        console.log(JSON.stringify(webpackConfig, null, 4));\n\n        // Always return the config object.\n        return webpackConfig;\n    }\n};\n```\n\nRegistration (in a `craco.config.js` file):\n\n```javascript\nconst logWebpackConfigPlugin = require(\"./craco-plugin-log-webpack-config\");\n\nmodule.exports = {\n    ...\n    plugins: [\n        { plugin: logWebpackConfigPlugin, options: { preText: \"Will log the webpack config:\" } }\n    ]\n};\n```\n\n### overrideJestConfig\n\nThe function `overrideJestConfig` let a plugin override the `Jest` config object **after** it's been customized by `craco`.\n\n*The function must return a valid config object, otherwise `craco` will throw an error.*\n\nThe function will be called with a single object argument having the following structure:\n\n```javascript\n{\n    jestConfig: \"The Jest config object already customized by craco\",\n    cracoConfig: \"The configuration object read from the craco.config.js file provided by the consumer\",\n    pluginOptions: \"The plugin options provided by the consumer\",\n    context: {\n        env: \"The current NODE_ENV (development, production, etc..)\",\n        paths: \"An object that contains all the paths used by CRA\",\n        resolve: \"Provided by CRA\",\n        rootDir: \"Provided by CRA\"\n    }\n}\n```\n\n#### Example\n\nPlugin:\n\n```javascript\n/* craco-plugin-log-jest-config.js */\n\nmodule.exports = {\n    overrideJestConfig: ({ jestConfig, cracoConfig, pluginOptions, context: { env, paths, resolve, rootDir } }) => {\n        if (pluginOptions.preText) {\n            console.log(pluginOptions.preText);\n        }\n\n        console.log(JSON.stringify(jestConfig, null, 4));\n\n        // Always return the config object.\n        return jestConfig;\n    }\n};\n```\n\nRegistration (in a `craco.config.js` file):\n\n```javascript\nconst logJestConfigPlugin = require(\"./craco-plugin-log-jest-config\");\n\nmodule.exports = {\n    ...\n    plugins: [\n        { plugin: logJestConfigPlugin, options: { preText: \"Will log the Jest config:\" } }\n    ]\n};\n```\n\n### Utility functions\n\nA few utility functions are provided by `craco` to develop a plugin:\n\n```javascript\nconst { getLoader, getLoaders, removeLoader, loaderByName, throwUnexpectedConfigError } = require(\"@craco/craco\");\n```\n\n#### getLoader\n\nRetrieve the **first** loader that match the specified criteria from the webpack config.\n\nReturns:\n\n```javascript\n{\n    isFound: true | false,\n    match: {\n        loader,\n        parent,\n        index\n    }\n}\n```\n\nUsage:\n\n```javascript\nconst { getLoader, loaderByName } = require(\"@craco/craco\");\n\nconst { isFound, match } = getLoader(webpackConfig, loaderByName(\"eslint-loader\"));\n\nif (isFound) {\n    // do stuff...\n}\n```\n\n#### getLoaders\n\nRetrieve **all** the loaders that match the specified criteria from the webpack config.\n\nReturns:\n\n```javascript\n{\n    hasFoundAny: true | false,\n    matches: [\n        {\n            loader,\n            parent,\n            index\n        }\n    ]\n}\n```\n\nUsage:\n\n```javascript\nconst { getLoaders, loaderByName } = require(\"@craco/craco\");\n\nconst { hasFoundAny, matches } = getLoaders(webpackConfig, loaderByName(\"babel-loader\"));\n\nif (hasFoundAny) {\n    matches.forEach(x => {\n        // do stuff...\n    });\n}\n```\n\n#### removeLoaders\n\nRemove **all** the loaders that match the specified criteria from the webpack config.\n\nReturns:\n\n```javascript\n{\n    hasRemovedAny:: true | false,\n    removedCount:: int\n}\n```\n\nUsage:\n\n```javascript\nconst { removeLoaders, loaderByName } = require(\"@craco/craco\");\n\nremoveLoaders(webpackConfig, loaderByName(\"eslint-loader\"));\n```\n\n#### addBeforeLoader\n\nAdd a new *loader* **before** the loader that match specified criteria to the webpack config.\n\nReturns:\n\n```javascript\n{\n    isAdded: true | false\n}\n```\n\nUsage:\n\n```javascript\nconst { addBeforeLoader, loaderByName } = require(\"@craco/craco\");\n\nconst myNewWebpackLoader = {\n    loader: require.resolve(\"tslint-loader\")\n};\n\naddBeforeLoader(webpackConfig, loaderByName(\"eslint-loader\"), myNewWebpackLoader);\n```\n\n#### addBeforeLoaders\n\nAdd a new *loader* **before** all the loaders that match specified criteria to the webpack config.\n\nReturns:\n\n```javascript\n{\n    isAdded: true | false,\n    addedCount: int\n}\n```\n\nUsage:\n\n```javascript\nconst { addBeforeLoaders, loaderByName } = require(\"@craco/craco\");\n\nconst myNewWebpackLoader = {\n    loader: require.resolve(\"tslint-loader\")\n};\n\naddBeforeLoaders(webpackConfig, loaderByName(\"eslint-loader\"), myNewWebpackLoader);\n```\n\n#### addAfterLoader\n\nAdd a new *loader* **after** the loader that match specified criteria to the webpack config.\n\nReturns:\n\n```javascript\n{\n    isAdded: true | false\n}\n```\n\nUsage:\n\n```javascript\nconst { addAfterLoader, loaderByName } = require(\"@craco/craco\");\n\nconst myNewWebpackLoader = {\n    loader: require.resolve(\"tslint-loader\")\n};\n\naddAfterLoader(webpackConfig, loaderByName(\"eslint-loader\"), myNewWebpackLoader);\n```\n\n#### addAfterLoaders\n\nAdd a new *loader* **after** all the loaders that match specified criteria to the webpack config.\n\nReturns:\n\n```javascript\n{\n    isAdded: true | false,\n    addedCount: int\n}\n```\n\nUsage:\n\n```javascript\nconst { addAfterLoaders, loaderByName } = require(\"@craco/craco\");\n\nconst myNewWebpackLoader = {\n    loader: require.resolve(\"tslint-loader\")\n};\n\naddAfterLoaders(webpackConfig, loaderByName(\"eslint-loader\"), myNewWebpackLoader);\n```\n\n#### throwUnexpectedConfigError\n\nThrow an error if the webpack configuration changes and does not match your expectations. (For example, `getLoader` cannot find a loader and `isFound` is `false`.) `create-react-app` might update the structure of their webpack config, so it is very important to show a helpful error message when something breaks.\n\nRaises an error and crashes Node.js:\n\n```bash\n$ yarn start\nyarn run v1.12.3\n$ craco start\n/path/to/your/app/craco.config.js:23\n            throw new Error(\n            ^\n\n    Error: Can't find eslint-loader in the webpack config!\n\n    This error probably occurred because you updated react-scripts or craco. Please try updating craco-less to the latest version:\n\n       $ yarn upgrade craco-less\n\n    Or:\n\n       $ npm update craco-less\n\n    If that doesn't work, craco-less needs to be fixed to support the latest version.\n    Please check to see if there's already an issue in the ndbroadbent/craco-less repo:\n\n       * https://github.com/ndbroadbent/craco-less/issues?q=is%3Aissue+webpack+eslint-loader\n\n    If not, please open an issue and we'll take a look. (Or you can send a PR!)\n\n    You might also want to look for related issues in the craco and create-react-app repos:\n\n       * https://github.com/sharegate/craco/issues?q=is%3Aissue+webpack+eslint-loader\n       * https://github.com/facebook/create-react-app/issues?q=is%3Aissue+webpack+eslint-loader\n\n    at throwUnexpectedConfigError (/path/to/your/app/craco.config.js:23:19)\n    ...\n```\n\nUsage:\n\n```javascript\nconst { getLoader, loaderByName, throwUnexpectedConfigError } = require(\"@craco/craco\");\n\n// Create a helper function if you need to call this multiple times\nconst throwError = (message, githubIssueQuery) =>\n    throwUnexpectedConfigError({\n        packageName: \"craco-less\",\n        githubRepo: \"ndbroadbent/craco-less\",\n        message,\n        githubIssueQuery,\n    });\n\nconst { isFound, match } = getLoader(webpackConfig, loaderByName(\"eslint-loader\"));\n\nif (!isFound) {\n    throwError(\"Can't find eslint-loader in the webpack config!\", \"webpack+eslint-loader\")\n}\n```\n\nOptions:\n\n```javascript\n{\n    message: \"An error message explaining what went wrong\",\n    packageName: \"NPM package name\",\n    githubRepo: \"GitHub repo where people can open an issue. Format: username/repo\",\n    githubIssueQuery: \"Search string to find related issues\"\n}\n```\n\n> Only `message` is required.\n\n## Acknowledgements\n\n[@timarney](https://github.com/timarney) for having created [react-app-rewired](https://github.com/timarney/react-app-rewired).\n\n## License\n\nCopyright © 2018, Groupe Sharegate inc. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/sharegate/craco/blob/master/LICENSE.\n","readmeFilename":"README.md"}