Webpack 및 react-rounter를 사용하여 프로젝트를 빌드합니다. 내가 "http://127.0.0.1:3001/purchase"
를 요청하면 작업이React-router bundle.js와 함께 Webpack 사용하기
ReactDOM.render(
<Provider store={store}>
<Router history={ browserHistory }>
<Route path='/' component={ App } >
<IndexRoute component={ Home } />
<Route path="purchase" component={ Purchase } />
<Route path="purchase/:id" component={ Purchase } />
</Route>
</Router>
</Provider>,
document.getElementById('example')
);
입니다 : 이 내 코드입니다! 주소 "http://127.0.0.1:3001/purchase/a"
에 오류가 있습니다. enter image description here
내 WebpackDevServer의 설정은 다음과 같습니다 : 오류 메시지를 볼
new WebpackDevServer (webpack(config), {
publicPath: config.output.publicPath,
hot: true,
noInfo: false,
historyApiFallback: true
}).listen(3001, '127.0.0.1', function (err, result) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:3001');
});
나는 문제가, 도와주세요 모르겠어요!
굉장! 그것은 내 문제를 해결합니다. 고마워요! –
아주 대단해! 몇 시간 전에 대답을 찾았 으면 좋겠습니다. : – challenger
하지만 index.html에는 파일에 bundle.js가 없으므로 상대 경로와 함께 자동으로 삽입됩니다. – Curtis