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

Importing react-dom without using it cause error after upgrading

刚刚将 react-dom 更新到版本 16.5.2,我的所有测试都开始失败:requirejs error occurred TypeError: Cannot read property 'unstable_cancelScheduledWork' of undefined

我在发行说明上没有看到任何相关错误/使用它的任何相关问题所以我认为我做错了什么..

当我评论 import ReactDOM from 'react-dom' 时,测试没有崩溃..(也没有通过..)

有什么地方可能做错了吗?

正如 Brian Vaughn(React 核心团队成员)在 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.

...您可以固定到例如16.4.2 来缓解这个问题。