Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

customize-cra

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

customize-cra - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var flow=_interopDefault(require("lodash.flow"));function _defineProperty(e,s,r){return s in e?Object.defineProperty(e,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[s]=r,e}function _objectSpread2(e){for(var s=1;s<arguments.length;s++)if(s%2){var r=null!=arguments[s]?arguments[s]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(s){_defineProperty(e,s,r[s])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[s]));return e}const getBabelLoader=(e,s)=>{let r;r=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let o=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,l=o.find(r);return l||(l=(o=o.reduce((e,s)=>e.concat(s.use||[]),[])).find(r)),l},addBundleVisualizer=(e={},s=!1)=>r=>{const o=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||r.plugins.push(new o(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),r},disableEsLint=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},addWebpackAlias=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),addWebpackResolve=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),addWebpackPlugin=e=>s=>(s.plugins.push(e),s),adjustWorkbox=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),useEslintRc=e=>s=>{const r=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];r.use[0].options.useEslintrc=!0,r.use[0].options.ignore=!0,r.use[0].options.configFile=e,delete r.use[0].options.baseConfig;const o=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?r:e);return s.module.rules=o,s},enableEslintTypescript=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const r=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=r,e},addLessLoader=(e={})=>s=>{const r="development"===process.env.NODE_ENV?"dev":"prod",o="./"===require("react-scripts/config/paths").servedPath,l="prod"===r&&"false"!==process.env.GENERATE_SOURCEMAP,t=/\.module\.less$/,a=e.localIdentName||"[path][name]__[local]--[hash:base64:5]",n=s=>["dev"===r?require.resolve("style-loader"):{loader:require("mini-css-extract-plugin").loader,options:Object.assign({},o?{publicPath:"../../"}:void 0)},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3})],sourceMap:l}},{loader:require.resolve("less-loader"),options:Object.assign(e,{source:l})}],d=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return d.splice(d.length-1,0,{test:/\.less$/,exclude:t,use:n({importLoaders:2}),sideEffects:"prod"===r},{test:t,use:n({importLoaders:2,modules:!0,localIdentName:a})}),s},watchAll=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),disableChunk=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),addWebpackExternals=e=>s=>{let r=s.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=_objectSpread2({},r,{},e)):r=e,s.externals=r,s},addPostcssPlugins=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const r=s.options.plugins;s.options.plugins=()=>[...r(),...e]}})),s},removeModuleScopePlugin=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),addWebpackModuleRule=e=>s=>(s.module.rules.push(e),s),addTslintLoader=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),addBabelPlugin=e=>s=>(getBabelLoader(s).options.plugins.push(e),s),addExternalBabelPlugin=e=>s=>{const r=getBabelLoader(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},addBabelPreset=e=>s=>(getBabelLoader(s).options.presets.push(e),s),addDecoratorsLegacy=()=>e=>addBabelPlugin(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),useBabelRc=()=>e=>(getBabelLoader(e).options.babelrc=!0,e),babelInclude=e=>s=>(getBabelLoader(s).include=e,s),babelExclude=e=>s=>(getBabelLoader(s).exclude=e,s),addBabelPlugins=(...e)=>e.map(e=>addBabelPlugin(e)),addExternalBabelPlugins=(...e)=>e.map(e=>addExternalBabelPlugin(e)),addBabelPresets=(...e)=>e.map(e=>addBabelPreset(e)),fixBabelImports=(e,s)=>addBabelPlugin(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),override=(...e)=>flow(...e.filter(e=>e)),overrideDevServer=(...e)=>s=>(r,o)=>{const l=s(r,o);return override(...e)(l)};exports.addBabelPlugin=addBabelPlugin,exports.addBabelPlugins=addBabelPlugins,exports.addBabelPreset=addBabelPreset,exports.addBabelPresets=addBabelPresets,exports.addBundleVisualizer=addBundleVisualizer,exports.addDecoratorsLegacy=addDecoratorsLegacy,exports.addExternalBabelPlugin=addExternalBabelPlugin,exports.addExternalBabelPlugins=addExternalBabelPlugins,exports.addLessLoader=addLessLoader,exports.addPostcssPlugins=addPostcssPlugins,exports.addTslintLoader=addTslintLoader,exports.addWebpackAlias=addWebpackAlias,exports.addWebpackExternals=addWebpackExternals,exports.addWebpackModuleRule=addWebpackModuleRule,exports.addWebpackPlugin=addWebpackPlugin,exports.addWebpackResolve=addWebpackResolve,exports.adjustWorkbox=adjustWorkbox,exports.babelExclude=babelExclude,exports.babelInclude=babelInclude,exports.disableChunk=disableChunk,exports.disableEsLint=disableEsLint,exports.enableEslintTypescript=enableEslintTypescript,exports.fixBabelImports=fixBabelImports,exports.getBabelLoader=getBabelLoader,exports.override=override,exports.overrideDevServer=overrideDevServer,exports.removeModuleScopePlugin=removeModuleScopePlugin,exports.useBabelRc=useBabelRc,exports.useEslintRc=useEslintRc,exports.watchAll=watchAll;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var flow=_interopDefault(require("lodash.flow"));function _defineProperty(e,s,r){return s in e?Object.defineProperty(e,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[s]=r,e}function _objectSpread2(e){for(var s=1;s<arguments.length;s++)if(s%2){var r=null!=arguments[s]?arguments[s]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(s){_defineProperty(e,s,r[s])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[s]));return e}const getBabelLoader=(e,s)=>{let r;r=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let o=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,l=o.find(r);return l||(l=(o=o.reduce((e,s)=>e.concat(s.use||[]),[])).find(r)),l},addBundleVisualizer=(e={},s=!1)=>r=>{const o=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||r.plugins.push(new o(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),r},disableEsLint=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},addWebpackAlias=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),addWebpackResolve=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),addWebpackPlugin=e=>s=>(s.plugins.push(e),s),adjustWorkbox=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),useEslintRc=e=>s=>{const r=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];r.use[0].options.useEslintrc=!0,r.use[0].options.ignore=!0,r.use[0].options.configFile=e,delete r.use[0].options.baseConfig;const o=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?r:e);return s.module.rules=o,s},enableEslintTypescript=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const r=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=r,e},addLessLoader=(e={})=>s=>{const r="development"===process.env.NODE_ENV?"dev":"prod",o="./"===require("react-scripts/config/paths").servedPath,l="prod"===r&&"false"!==process.env.GENERATE_SOURCEMAP,t=/\.module\.less$/,a=e.localIdentName||"[path][name]__[local]--[hash:base64:5]",n=s=>["dev"===r?require.resolve("style-loader"):{loader:require("mini-css-extract-plugin").loader,options:Object.assign({},o?{publicPath:"../../"}:void 0)},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3})],sourceMap:l}},{loader:require.resolve("less-loader"),options:Object.assign(e,{source:l})}],d=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return d.splice(d.length-1,0,{test:/\.less$/,exclude:t,use:n({importLoaders:2}),sideEffects:"prod"===r},{test:t,use:n({importLoaders:2,modules:!0,localIdentName:a})}),s},watchAll=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),disableChunk=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),addWebpackExternals=e=>s=>{let r=s.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=_objectSpread2({},r,{},e)):r=e,s.externals=r,s},addPostcssPlugins=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const r=s.options.plugins;s.options.plugins=()=>[...r(),...e]}})),s},removeModuleScopePlugin=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),addWebpackModuleRule=e=>s=>(s.module.rules.push(e),s),addTslintLoader=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),setWebpackTarget=e=>s=>(s.target=e,s),addBabelPlugin=e=>s=>(getBabelLoader(s).options.plugins.push(e),s),addExternalBabelPlugin=e=>s=>{const r=getBabelLoader(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},addBabelPreset=e=>s=>(getBabelLoader(s).options.presets.push(e),s),addDecoratorsLegacy=()=>e=>addBabelPlugin(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),useBabelRc=()=>e=>(getBabelLoader(e).options.babelrc=!0,e),babelInclude=e=>s=>(getBabelLoader(s).include=e,s),babelExclude=e=>s=>(getBabelLoader(s).exclude=e,s),addBabelPlugins=(...e)=>e.map(e=>addBabelPlugin(e)),addExternalBabelPlugins=(...e)=>e.map(e=>addExternalBabelPlugin(e)),addBabelPresets=(...e)=>e.map(e=>addBabelPreset(e)),fixBabelImports=(e,s)=>addBabelPlugin(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),override=(...e)=>flow(...e.filter(e=>e)),overrideDevServer=(...e)=>s=>(r,o)=>{const l=s(r,o);return override(...e)(l)};exports.addBabelPlugin=addBabelPlugin,exports.addBabelPlugins=addBabelPlugins,exports.addBabelPreset=addBabelPreset,exports.addBabelPresets=addBabelPresets,exports.addBundleVisualizer=addBundleVisualizer,exports.addDecoratorsLegacy=addDecoratorsLegacy,exports.addExternalBabelPlugin=addExternalBabelPlugin,exports.addExternalBabelPlugins=addExternalBabelPlugins,exports.addLessLoader=addLessLoader,exports.addPostcssPlugins=addPostcssPlugins,exports.addTslintLoader=addTslintLoader,exports.addWebpackAlias=addWebpackAlias,exports.addWebpackExternals=addWebpackExternals,exports.addWebpackModuleRule=addWebpackModuleRule,exports.addWebpackPlugin=addWebpackPlugin,exports.addWebpackResolve=addWebpackResolve,exports.adjustWorkbox=adjustWorkbox,exports.babelExclude=babelExclude,exports.babelInclude=babelInclude,exports.disableChunk=disableChunk,exports.disableEsLint=disableEsLint,exports.enableEslintTypescript=enableEslintTypescript,exports.fixBabelImports=fixBabelImports,exports.getBabelLoader=getBabelLoader,exports.override=override,exports.overrideDevServer=overrideDevServer,exports.removeModuleScopePlugin=removeModuleScopePlugin,exports.setWebpackTarget=setWebpackTarget,exports.useBabelRc=useBabelRc,exports.useEslintRc=useEslintRc,exports.watchAll=watchAll;
//# sourceMappingURL=index.cjs.js.map

@@ -1,2 +0,2 @@

import e from"lodash.flow";function s(e,s,o){return s in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,e}const o=(e,s)=>{let o;o=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,t=r.find(o);return t||(t=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(o)),t},r=(e={},s=!1)=>o=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||o.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),o},t=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},n=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),l=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),i=e=>s=>(s.plugins.push(e),s),u=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),a=e=>s=>{const o=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];o.use[0].options.useEslintrc=!0,o.use[0].options.ignore=!0,o.use[0].options.configFile=e,delete o.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?o:e);return s.module.rules=r,s},c=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const o=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=o,e},p=(e={})=>s=>{const o="development"===process.env.NODE_ENV?"dev":"prod",r="./"===require("react-scripts/config/paths").servedPath,t="prod"===o&&"false"!==process.env.GENERATE_SOURCEMAP,n=/\.module\.less$/,l=e.localIdentName||"[path][name]__[local]--[hash:base64:5]",i=s=>["dev"===o?require.resolve("style-loader"):{loader:require("mini-css-extract-plugin").loader,options:Object.assign({},r?{publicPath:"../../"}:void 0)},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3})],sourceMap:t}},{loader:require.resolve("less-loader"),options:Object.assign(e,{source:t})}],u=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return u.splice(u.length-1,0,{test:/\.less$/,exclude:n,use:i({importLoaders:2}),sideEffects:"prod"===o},{test:n,use:i({importLoaders:2,modules:!0,localIdentName:l})}),s},d=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),f=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),m=e=>o=>{let r=o.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=function(e){for(var o=1;o<arguments.length;o++)if(o%2){var r=null!=arguments[o]?arguments[o]:{},t=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.forEach(function(o){s(e,o,r[o])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[o]));return e}({},r,{},e)):r=e,o.externals=r,o},g=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const o=s.options.plugins;s.options.plugins=()=>[...o(),...e]}})),s},b=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),v=e=>s=>(s.module.rules.push(e),s),O=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),h=e=>s=>(o(s).options.plugins.push(e),s),y=e=>s=>{const r=o(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},E=e=>s=>(o(s).options.presets.push(e),s),j=()=>e=>h(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),x=()=>e=>(o(e).options.babelrc=!0,e),A=e=>s=>(o(s).include=e,s),P=e=>s=>(o(s).exclude=e,s),w=(...e)=>e.map(e=>h(e)),q=(...e)=>e.map(e=>y(e)),z=(...e)=>e.map(e=>E(e)),N=(e,s)=>h(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),S=(...s)=>e(...s.filter(e=>e)),$=(...e)=>s=>(o,r)=>{const t=s(o,r);return S(...e)(t)};export{h as addBabelPlugin,w as addBabelPlugins,E as addBabelPreset,z as addBabelPresets,r as addBundleVisualizer,j as addDecoratorsLegacy,y as addExternalBabelPlugin,q as addExternalBabelPlugins,p as addLessLoader,g as addPostcssPlugins,O as addTslintLoader,n as addWebpackAlias,m as addWebpackExternals,v as addWebpackModuleRule,i as addWebpackPlugin,l as addWebpackResolve,u as adjustWorkbox,P as babelExclude,A as babelInclude,f as disableChunk,t as disableEsLint,c as enableEslintTypescript,N as fixBabelImports,o as getBabelLoader,S as override,$ as overrideDevServer,b as removeModuleScopePlugin,x as useBabelRc,a as useEslintRc,d as watchAll};
import e from"lodash.flow";function s(e,s,o){return s in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,e}const o=(e,s)=>{let o;o=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,t=r.find(o);return t||(t=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(o)),t},r=(e={},s=!1)=>o=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||o.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),o},t=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},n=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),l=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),i=e=>s=>(s.plugins.push(e),s),u=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),a=e=>s=>{const o=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];o.use[0].options.useEslintrc=!0,o.use[0].options.ignore=!0,o.use[0].options.configFile=e,delete o.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?o:e);return s.module.rules=r,s},c=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const o=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=o,e},p=(e={})=>s=>{const o="development"===process.env.NODE_ENV?"dev":"prod",r="./"===require("react-scripts/config/paths").servedPath,t="prod"===o&&"false"!==process.env.GENERATE_SOURCEMAP,n=/\.module\.less$/,l=e.localIdentName||"[path][name]__[local]--[hash:base64:5]",i=s=>["dev"===o?require.resolve("style-loader"):{loader:require("mini-css-extract-plugin").loader,options:Object.assign({},r?{publicPath:"../../"}:void 0)},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3})],sourceMap:t}},{loader:require.resolve("less-loader"),options:Object.assign(e,{source:t})}],u=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return u.splice(u.length-1,0,{test:/\.less$/,exclude:n,use:i({importLoaders:2}),sideEffects:"prod"===o},{test:n,use:i({importLoaders:2,modules:!0,localIdentName:l})}),s},d=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),f=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),m=e=>o=>{let r=o.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=function(e){for(var o=1;o<arguments.length;o++)if(o%2){var r=null!=arguments[o]?arguments[o]:{},t=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.forEach(function(o){s(e,o,r[o])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[o]));return e}({},r,{},e)):r=e,o.externals=r,o},g=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const o=s.options.plugins;s.options.plugins=()=>[...o(),...e]}})),s},b=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),v=e=>s=>(s.module.rules.push(e),s),O=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),h=e=>s=>(s.target=e,s),y=e=>s=>(o(s).options.plugins.push(e),s),E=e=>s=>{const r=o(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},j=e=>s=>(o(s).options.presets.push(e),s),x=()=>e=>y(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),A=()=>e=>(o(e).options.babelrc=!0,e),P=e=>s=>(o(s).include=e,s),w=e=>s=>(o(s).exclude=e,s),q=(...e)=>e.map(e=>y(e)),z=(...e)=>e.map(e=>E(e)),N=(...e)=>e.map(e=>j(e)),S=(e,s)=>y(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),$=(...s)=>e(...s.filter(e=>e)),k=(...e)=>s=>(o,r)=>{const t=s(o,r);return $(...e)(t)};export{y as addBabelPlugin,q as addBabelPlugins,j as addBabelPreset,N as addBabelPresets,r as addBundleVisualizer,x as addDecoratorsLegacy,E as addExternalBabelPlugin,z as addExternalBabelPlugins,p as addLessLoader,g as addPostcssPlugins,O as addTslintLoader,n as addWebpackAlias,m as addWebpackExternals,v as addWebpackModuleRule,i as addWebpackPlugin,l as addWebpackResolve,u as adjustWorkbox,w as babelExclude,P as babelInclude,f as disableChunk,t as disableEsLint,c as enableEslintTypescript,S as fixBabelImports,o as getBabelLoader,$ as override,k as overrideDevServer,b as removeModuleScopePlugin,h as setWebpackTarget,A as useBabelRc,a as useEslintRc,d as watchAll};
//# sourceMappingURL=index.esm.js.map
{
"name": "customize-cra",
"version": "0.5.0",
"version": "0.6.0",
"description": "",

@@ -5,0 +5,0 @@ "repository": "arackaf/customize-cra",

@@ -1,35 +0,113 @@

# customize-cra
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
# `customize-cra`
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
This project provides a set of utilities to customize [`create-react-app`](https://github.com/facebook/create-react-app) versions 2 and 3 configurations leveraging [`react-app-rewired`](https://github.com/timarney/react-app-rewired/) core functionalities.
- [How to install](#how-to-install)
- [Warning](#warning)
- [Overview](#overview)
- [Usage](#usage)
- [With `webpack`](#with-webpack)
- [With `webpack-dev-server`](#with-webpack-dev-server)
- [With `MobX`](#with-mobx)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Contributors](#contributors)
## How to install
⚠️ make sure you have [react-app-rewired](https://github.com/timarney/react-app-rewired/) installed. You need to use this project with `react-app-rewired`; be sure to read their docs if you never have. The code in this project, documented below, is designed to work inside of `react-app-rewired`'s `config-overrides.js` file.
This project relies on [`react-app-rewired`](https://github.com/timarney/react-app-rewired/). You'll need to install that in order for `customize-cra` to work.
### npm
```bash
npm install customize-cra --save-dev
yarn add customize-cra react-app-rewired --dev
```
### yarn
## ❗ Warning
```bash
yarn add customize-cra --dev
```
## Warning
> "Stuff can break"
> \- Dan Abramov
Using this library will override default behavior and configuration of create-react-app, and therefore invalidate the guarantees that come with it. Use with discretion!
Using this library will override the default behavior and configuration of `create-react-app`, therefore invalidating the guarantees that come with it. Use with discretion!
## Overview
To start, this project will export functions I need for what I'm using CRA for, but PRs will of course be welcome.
`customize-cra` takes advantage of `react-app-rewired`'s `config-overrides.js` file. By importing `customize-cra` functions and exporting a few function calls wrapped in our `override` function, you can easily modify the underlying config objects (`webpack`, `webpack-dev-server`, `babel`, etc.) that make up `create-react-app`.
The functions documented below can be imported by name, and used in your `config-overrides.js` file, as explained below.
## Usage
**Note:** all code should be added to `config-overrides.js` at the same level as `package.json`.
See the [api docs](api.md) for documentation for each function.
### With `webpack`
To use these plugins, import the `override` function, and call it with whatever plugins you need. Each of these plugin invocations will return a new function, that `override` will call with the newly modified config object. Falsy values will be ignored though, so if you need to conditionally apply any of these plugins, you can do so like below.
For example:
```js
const {
override,
addDecoratorsLegacy,
disableEsLint,
addBundleVisualizer,
addWebpackAlias,
adjustWorkbox
} = require("customize-cra");
const path = require("path");
module.exports = override(
// enable legacy decorators babel plugin
addDecoratorsLegacy(),
// disable eslint in webpack
disableEsLint(),
// add webpack bundle visualizer if BUNDLE_VISUALIZE flag is enabled
process.env.BUNDLE_VISUALIZE == 1 && addBundleVisualizer(),
// add an alias for "ag-grid-react" imports
addWebpackAlias({
["ag-grid-react$"]: path.resolve(__dirname, "src/shared/agGridWrapper.js")
}),
// adjust the underlying workbox
adjustWorkbox(wb =>
Object.assign(wb, {
skipWaiting: true,
exclude: (wb.exclude || []).concat("index.html")
})
)
);
```
### With `webpack-dev-server`
You can use the `overrideDevServer` function to override the `webpack-dev-server` config. It works the same way as `override`:
```js
const {
override,
disableEsLint,
overrideDevServer,
watchAll
} = require("customize-cra");
module.exports = {
webpack: override(
// usual webpack plugin
disableEsLint()
),
devServer: overrideDevServer(
// dev server plugin
watchAll()
)
};
```
### With `MobX`
If you want CRA 2 to work with MobX, use the `addDecoratorsLegacy` and `disableEsLint`.
## Documentation

@@ -56,2 +134,4 @@

<td align="center"><a href="https://github.com/m-weeks"><img src="https://avatars0.githubusercontent.com/u/37918120?v=4" width="100px;" alt="m-weeks"/><br /><sub><b>m-weeks</b></sub></a><br /><a href="https://github.com/arackaf/customize-cra/issues?q=author%3Am-weeks" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/wuchaoya"><img src="https://avatars2.githubusercontent.com/u/20284675?v=4" width="100px;" alt="吴超"/><br /><sub><b>吴超</b></sub></a><br /><a href="#example-wuchaoya" title="Examples">💡</a></td>
<td align="center"><a href="http://jamesthistlewood.co.uk"><img src="https://avatars3.githubusercontent.com/u/8274049?v=4" width="100px;" alt="James Thistlewood"/><br /><sub><b>James Thistlewood</b></sub></a><br /><a href="https://github.com/arackaf/customize-cra/commits?author=jthistle" title="Code">💻</a></td>
</tr>

@@ -64,2 +144,2 @@ </table>

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc