home > tools > Bundler > webpack >

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

author:zhoulujun@live.cn    hits:

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 ,期待官方修复!


 


转载本站文章《Can't resolve 'react-dom/lib/ReactTestUtils' in 'react-addons-test-utils'》, 请注明出处:https://www.zhoulujun.cn/html/tools/Bundler/webpack/2016_0217_6459.html