Error: Cannot resolve module 'react-dom'
Error: Cannot resolve module 'react-dom'
当 运行 带有 babel-loader 的 webpack
时出现错误
Module not found: Error: Cannot resolve module 'react-dom'
这是我的导入声明
import ReactDOM from 'react-dom' ;
我正在使用 React 0.14.0
在 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.
当 运行 带有 babel-loader 的 webpack
时出现错误Module not found: Error: Cannot resolve module 'react-dom'
这是我的导入声明
import ReactDOM from 'react-dom' ;
我正在使用 React 0.14.0
在 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.