20 lines
565 B
JavaScript
20 lines
565 B
JavaScript
const path = require('path');
|
|
const { getLoader, loaderByName } = require('@craco/craco');
|
|
|
|
const packages = [];
|
|
packages.push(path.join(__dirname, '../module'));
|
|
|
|
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;
|
|
},
|
|
},
|
|
};
|