Skip to content

Instantly share code, notes, and snippets.

@PhilippMolitor
Created July 21, 2021 10:56
Show Gist options
  • Save PhilippMolitor/00f427d12a9c5bca84309058d88846b7 to your computer and use it in GitHub Desktop.
Save PhilippMolitor/00f427d12a9c5bca84309058d88846b7 to your computer and use it in GitHub Desktop.
Fix including yarn workspaces packages in create-react-app with craco
module.exports = {
webpack: {
configure: (webpackConfig) => ({
...webpackConfig,
module: {
...webpackConfig.module,
rules: webpackConfig.module.rules.map((rule) => {
if (!rule.oneOf) return rule;
return {
...rule,
oneOf: rule.oneOf.map((ruleObject) => {
if (
!new RegExp(ruleObject.test).test('.ts') ||
!ruleObject.include
)
return ruleObject;
return { ...ruleObject, include: undefined };
}),
};
}),
},
}),
},
};
@nsalleron-omedo
Copy link

Thank you. This really help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment