我是新手webpack,我开始使用webpack和react 15构建一个应用程序,但是看起来导出默认设置不能正常工作,因为我收到一个错误,因为找不到应用程序组件:
5:9 App not found in './components/App' import/named
下面是我的index.js代码:
import React from 'react';
import ReactDOM from 'react-dom';
import {Router,Route,IndexRoute,browserHistory} from 'react-router';
import { Provider } from 'react-redux';
import {App} from './components/App';
import {HomePage} from './components/HomePage';
import configureStore from './store/configureStore.js';
import { syncHistoryWithStore } from 'react-router-redux';
const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={HomePage}/>
</Route>
</Router>
</Provider>,
document.getElementById('app')
);
和我的App.js的代码放在components文件夹下:
import React, { PropTypes } from 'react';
const App = (props) => {
return (
<div>
{props.children}
</div>
);
};
App.propTypes = {
children: PropTypes.element
};
export default App;
任何人都能看到问题所在吗?看起来不支持这种类型的导出,我必须启用一些东西吗?任何帮助都将不胜感激!
发布于 2016-08-20 16:50:58
https://stackoverflow.com/questions/39056498
复制相似问题