简体   繁体   English

升级后导入react-dom而不使用会导致错误

[英]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 .刚刚将react-dom更新到版本16.5.2 ,并且我所有的测试都开始失败,因为: 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..)当我评论import ReactDOM from 'react-dom' ,测试不会崩溃..(也不会通过..)

Any ideas what could be done wrong?任何想法可能会做错什么?

As outlined by Brian Vaughn (React core team member) in this issue ...正如 Brian Vaughn(React 核心团队成员)在这个问题中所概述的那样......

Yeah, the schedule dependency was added to react-dom in version 16.5.0.是的,在 16.5.0 版本中, schedule依赖被添加到react-dom中。 If you need to not depend on it for the time being, 16.4.2 would be a reasonable version to pin to.如果您暂时不需要依赖它,16.4.2 将是一个合理的版本。

... you can pin to eg 16.4.2 to mitigate this issue. ...您可以固定到例如16.4.2以缓解此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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