2015-09-02 45 views
1

我试图站起来,用的WebPack-dev的服务器和反应路由器运行。我的问题是,我似乎不能我的装载时的主要文件的样子让连基本的网页:怎样的WebPack加载反应路由器/ lib目录/ HashHistory或反应路由器/ lib目录/ BrowserHistory?

import React from 'react' 
import { history } from 'react-router/lib/HashHistory' 
import App from './js/app' 


React.render(<App history={history} />, document.getElementById('app')); 

而且我有一个非标准webpack.config.js。

怎样的WebPack加载从 '反应路由器/ lib目录/ HashHistory' 什么?该路由器不会在硬盘上生成任何物理文件。从哪里加载? 难道只是这样issue提出最新的测试版的问题吗?

回答

6

[email protected] History转移到它自己的NPM模块https://www.npmjs.com/package/history

import createHistory from 'history/lib/createBrowserHistory'; 
React.render(<Router history={createHistory()} routes={routes}/> 
      , document.getElementById('app')); 
+0

为什么我没有在该文档中发现这一点,因为我到处试图解决这个问题! –