Saya pikir masalahnya bukan pada konfigurasi router reaksi tetapi index.html saya tidak dapat mendeteksi skrip saya? Ini kesalahan saya:
Gagal memuat sumber daya: server merespons dengan status 404 (Tidak Ditemukan)
ini kode konfigurasi webpack saya:
const compiler = webpack({
entry: ['whatwg-fetch', path.resolve(__dirname, 'js', 'index.js')],
module: {
loaders: [
{
exclude: /node_modules/,
loader: 'babel-loader',
test: /\.js$/,
},
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
}
],
},
output: {filename: 'app.js', path: '/'},
});
const app = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': `http://localhost:${GRAPHQL_PORT}`},
publicPath: '/js/',
stats: {colors: true},
historyApiFallback: {
index: 'index.html'
}
});
dan indeks.html saya
<!doctype html>
<html lang="en" data-framework="relay">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.11/semantic.min.css">
<title>Relay • TodoMVC</title>
</head>
<body>
<div id="root"></div>
<script type="text/javascript">
// Force `fetch` polyfill to workaround Chrome not displaying request body
// in developer tools for the native `fetch`.
self.fetch = null;
</script>
<script src="http://localhost:4000/webpack-dev-server.js"></script>
<script src="js/app.js"></script>
</body>
</html>
Membantu?
historyApiFallback
ke true? - person Govind Rai   schedule 13.08.2017