首页 > tools > Bundler > webpack > > 正文

Can't resolve 'react-dom/lib/ReactTestUtils' in 'react-addons-test-utils'

发布人:zhoulujun@live.cn    点击:

webpack4 x 配置测试的时候,发现原来的测试模板不可用,Can t resolve react-dom lib ReactTestUtils in react-addons-test-utils

webpack4.x 配置测试的时候,发现原来的测试模板不可用

Module not found: Error: Can't resolve 'react-dom/lib/ReactTestUtils' in '/www/wepack4-react-project-template/node_modules/react-addons-test-utils'

    "react": "^16.7.0",

    "react-addons-test-utils": "^15.6.2",

    "react-dom": "^16.7.0",

react-dom 16 根本就没有lib/ReactTestUtils 这玩意儿。

于是修改,react-addons-test-utils index 文件,坑还是未填好

//module.exports = require('react-dom/lib/ReactTestUtils');

module.exports = require('react-dom/test-utils');


最好还是降级到15.x ,期待官方修复!