Skip to content

Instantly share code, notes, and snippets.

@techitesh
Created April 20, 2022 05:50
Show Gist options
  • Save techitesh/2b74f887261933b34b6d67de4431c331 to your computer and use it in GitHub Desktop.
Save techitesh/2b74f887261933b34b6d67de4431c331 to your computer and use it in GitHub Desktop.
Craco Config for Babel Loader
const path = require("path");
const { getLoader, loaderByName } = require("@craco/craco");
const packages = [];
packages.push(path.join(__dirname, "../ui-kit"));
module.exports = {
webpack: {
configure: (webpackConfig, arg) => {
const { isFound, match } = getLoader(
webpackConfig,
loaderByName("babel-loader")
);
if (isFound) {
const include = Array.isArray(match.loader.include)
? match.loader.include
: [match.loader.include];
match.loader.include = include.concat(packages);
}
return webpackConfig;
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment