craco-babel-loader
Version:
Rewire `babel-loader` loader in your `create-react-app` project using `craco`.
3 lines (2 loc) • 691 B
JavaScript
import{getLoader as r,loaderByName as c}from"@craco/craco";const e=r=>r?Array.isArray(r)?r:[r]:[],a=({webpackConfig:a,pluginOptions:{includes:o=[],excludes:n=[]}})=>{const i=r(a,c("babel-loader")),{isFound:u,match:l}=i;return u&&(o.forEach(r=>((r,...c)=>{const a=e(r.include),o=c.reduce((r,c)=>{if(Array.isArray(r)){if(Array.isArray(c))return r.concat(c);r.push(c)}return r},a);r.include=o})(null==l?void 0:l.loader,r)),n.forEach(r=>((r,...c)=>{const a=e(r.exclude),o=c.reduce((r,c)=>{if(Array.isArray(r)){if(Array.isArray(c))return r.concat(c);r.push(c)}return r},a);r.exclude=o})(null==l?void 0:l.loader,r))),a};export{a as overrideWebpackConfig};
//# sourceMappingURL=index.modern.js.map