简体   繁体   中英

Importing react-dom without using it cause error after upgrading

Just updated react-dom to version 16.5.2 , and all my tests have begun to fail dur to: requirejs error occurred TypeError: Cannot read property 'unstable_cancelScheduledWork' of undefined .

I didn't see any related errors on the release notes / any related issues using it so I assumed I've done something wrong..

When I comment import ReactDOM from 'react-dom' the test doesn't crash.. (doesn't pass either..)

Any ideas what could be done wrong?

As outlined by Brian Vaughn (React core team member) in this issue ...

Yeah, the schedule dependency was added to react-dom in version 16.5.0. If you need to not depend on it for the time being, 16.4.2 would be a reasonable version to pin to.

... you can pin to eg 16.4.2 to mitigate this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM