2017-03-15 1 views
0

http://localhost:8080으로 이동하면 제품 페이지가 예상대로 표시됩니다. http://localhost:8080/basket로 이동 그러나, 나는 브라우저에서 메시지가 :react-router - GET URL을 얻을 수 없습니다.

얻을 수 없다/바구니 여기

내 routes.js :

import React from 'react'; 
import { AppContainer } from 'react-hot-loader'; 
import { Router, Route, browserHistory, IndexRoute } from 'react-router'; 
import store from './store/store.js'; 
import { Provider } from 'react-redux'; 
import Error404 from './components/Error404.jsx'; 
import App from './containers/App.jsx'; 
import ProductsArea from './containers/shop/ProductsArea.jsx'; 
import BasketArea from './containers/shop/BasketArea.jsx'; 

const routes =() => (

    <AppContainer> 
     <Provider store={store}> 
      <Router history={browserHistory}> 
       <Route path="/" component={App}> 
        <IndexRoute component={ProductsArea} /> 
        <Route path="basket" component={BasketArea} /> 
       </Route> 
       <Route path="*" component={Error404} /> 
      </Router> 
     </Provider> 
    </AppContainer> 

); 

export default routes; 

답변

1

내 웹팩에 historyApiFallback: true 추가 .config.js 파일 :

module.exports = { 
    ... 
    devServer: { 
     historyApiFallback: true, 
     hot: true, 
     contentBase: path.resolve(__dirname, 'dist'), 
     publicPath: '/' 
    }, 
    ... 
} 
관련 문제