Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React路由器无法获取我的条目_Reactjs_Webpack_Webpack Dev Server - Fatal编程技术网

Reactjs React路由器无法获取我的条目

Reactjs React路由器无法获取我的条目,reactjs,webpack,webpack-dev-server,Reactjs,Webpack,Webpack Dev Server,你好,我有一个问题,反应路由器,我的代码 ReactDOM.render( <Provider store={store}> <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={StartPage}/> <Route path="/matches

你好,我有一个问题,反应路由器,我的代码

ReactDOM.render(
<Provider store={store}>
    <Router history={browserHistory}>
        <Route path="/" component={App}>
            <IndexRoute component={StartPage}/>
            <Route path="/matches" component={MatchesPage} />
            <Route path="/sector/:idparam" component={SectorsPage} />

        </Route>
    </Router>
</Provider>,
app);

我认为问题不在于react路由器,甚至是网页包。我认为您的问题与如何要求客户端js文件有关,尽管由于您没有包含该部分代码,我无法确认

看起来您正在包含相对于路径的脚本
无前导斜杠)而不是绝对路径(
)。

是否尝试在输出中添加publicPath属性:
输出:{path:u dirname+“/src/”,文件名:“client.min.js”,publicPath:“/”,
}
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');

module.exports = {
    context: path.join(__dirname, "src"),
    devtool: debug ? "inline-sourcemap" : null,
    entry: "./js/client.js",
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel',
                query: {
                    presets: ['react', 'es2015', 'stage-0'],
                    plugins: ['react-html-attrs', 'transform-decorators-legacy', 'transform-class-properties'],
                }
            }
        ]
    },
    output: {
        path: __dirname + "/src/",
        filename: "client.min.js"
    },
    plugins: debug ? [] : [
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin({mangle: false, sourcemap: false}),
    ],
    devServer: {
        historyApiFallback: true,
        contentBase: './',
        hot: true
    },
 };