dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
https://craco.js.org
Apache License 2.0
7.43k stars 499 forks source link

Craco with jest 27 createTransformer and _cracoConfig undefined with react-scripts 5 #462

Closed kelbyers closed 1 year ago

kelbyers commented 1 year ago

I'm using react-scripts 5.0.1, and get this error when running craco test:

TypeError: Cannot read properties of undefined (reading '_cracoConfig')

The same changes mentioned in #425 fixed the issue, but updating to craco 6.4.5 did not resolve the issue.

dilanx commented 1 year ago

What version of craco are you using?

kelbyers commented 1 year ago

I tried both 6.4.3 and 6.4.5. I currently have 6.4.3.

dilanx commented 1 year ago

Try using craco 7 (it just moved from alpha to latest) because craco 6 does not support CRA 5.

kelbyers commented 1 year ago

I'll give it a try tomorrow. I'm also using craco-antd, which also uses craco-less, and those set their peer dependencies to exactly version 6.4.3. I can configure my environment to use craco 7 instead, though.

kelbyers commented 1 year ago

craco 7 did resolve my issues. Thanks! It was still a beta when I looked earlier, and I didn't think to check if it had been released when I ran into the issue.