错误:无法解析模块 '反应-DOM'

问题描述:

与巴贝尔装载机运行的WebPack当我收到提示错误:无法解析模块 '反应-DOM'

Module not found: Error: Cannot resolve module 'react-dom' 

这里是我的import语句

import ReactDOM from 'react-dom' ; 

我使用的阵营0.14 .0

+1

你能运行并发布命令npm ls的结果吗? –

+1

升级后是否安装了react-dom软件包? –

+0

[email protected]当我运行npm ls时出现在列表中 –

在0.14.x版本中,dom渲染函数已被移入react-dom包中以更普遍。

As we look at packages like react-native, react-art, react-canvas, and react-three, it has become clear that the beauty and essence of React has nothing to do with browsers or the DOM.

To make this more clear and to make it easier to build more environments that React can render to, we’re splitting the main react package into two: react and react-dom. This paves the way to writing components that can be shared between the web version of React and React Native. We don’t expect all the code in an app to be shared, but we want to be able to share the components that do behave the same across platforms.

The react package contains React.createElement, .createClass, .Component, .PropTypes, .Children, and the other helpers related to elements and component classes. We think of these as the isomorphic or universal helpers that you need to build components.

The react-dom package has ReactDOM.render, .unmountComponentAtNode, and .findDOMNode. In react-dom/server we have server-side rendering support with ReactDOMServer.renderToString and .renderToStaticMarkup.