Created
July 21, 2021 10:56
-
-
Save PhilippMolitor/00f427d12a9c5bca84309058d88846b7 to your computer and use it in GitHub Desktop.
Fix including yarn workspaces packages in create-react-app with craco
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
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 }; | |
}), | |
}; | |
}), | |
}, | |
}), | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. This really help me.