Created
April 20, 2022 05:50
-
-
Save techitesh/2b74f887261933b34b6d67de4431c331 to your computer and use it in GitHub Desktop.
Craco Config for Babel Loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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