您在路线中提到的第一件事是具有path的home组件
/home。所以你需要参观
http://localhost:8080/home。另外,如果您尝试直接访问此网址,则由于使用,它也会给您此错误
browserHistory。如果您希望可以在
hashHistory或
HashRouterreact-
router
v4中使用,则需要访问
http://localhost:8080/#/home。如果要继续使用
browserHistory或
BrowserRouter在react-
router v4中使用,则需要
historyApiFallback: true在webpack中添加
var webpack = require('webpack');var path = require('path');var BUILD_DIR = path.resolve(__dirname, 'src/client/public');var APP_DIR = path.resolve(__dirname, 'src/client/app');var config = { entry: [ APP_DIR + '/config/routes.jsx', 'webpack/hot/dev-server', 'webpack-dev-server/client?http://localhost:8080' ], output: { publicPath: 'http://localhost:8080/src/client/public/' }, devServer: { historyApiFallback: true }, module : { loaders : [ { test: /.jsx?$/, loader: 'babel-loader', include: APP_DIR, exclude: /node_modules/, query: { presets: ['es2015'] } }, { test: /.scss$/, loaders: [ 'style', 'css', 'sass' ] }, { test: /.json$/, loader: "json-loader" } ] }};module.exports = config;


