ฉันคิดว่าปัญหาไม่ได้อยู่ที่การกำหนดค่าเราเตอร์แบบโต้ตอบ แต่ดัชนี.html ของฉันตรวจไม่พบสคริปต์ของฉัน นี่เป็นข้อผิดพลาดของฉัน:
ไม่สามารถโหลดทรัพยากร: เซิร์ฟเวอร์ตอบกลับด้วยสถานะ 404 (ไม่พบ)
นี่คือรหัสกำหนดค่า webpack ของฉัน:
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'
}
});
และ index.html ของฉัน
<!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>
ช่วย?
historyApiFallback
ให้เป็นจริงได้ไหม - person Govind Rai   schedule 13.08.2017