Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong bundle paths with browserHistory #15

Closed
Eschon opened this issue Jul 1, 2016 · 4 comments
Closed

wrong bundle paths with browserHistory #15

Eschon opened this issue Jul 1, 2016 · 4 comments

Comments

@Eschon
Copy link

Eschon commented Jul 1, 2016

When I included react-router-loader into my project I was using hashHistory with react-router. I tried switching to browserHistory I noticed that bundle urls are wrong when directly accessing a route.

I have my routes set up like this:

<Router history={browserHistory}
    <Route path="/" component={App}>
        <IndexRoute component={GridWrapper} />
        <Route path="/resorts" component={require('react-router!./modules/Resorts')} />
        <Route path="/resorts/:resort" component={require('react-router!./modules/Resort')} />
        <Route path="/community/tracks" component={require('react-router!./modules/Tracks')} />
    </Route>
</Router>

The output of my webpack configuration is:

output: {
    path: './dist/js',
    filename: 'bundle.js',
    publicPath: '/js/'
}

And I start my webpack-dev-server like this:
webpack-dev-server --content-base dist/ --history-api-fallback --inline --hot --host 0.0.0.0

Now when I navigate my browser to navigate to http://localhost:8080/resorts/7353 I get the following error in the browser console: GET http://localhost:8080/resorts/js/bundle.js 404 (Not Found). However if I just open http://localhost:8080/ and navigate there with react-router links it works.

Is this a bug or is there something wrong with my configuration?

@luqin
Copy link
Owner

luqin commented Jul 4, 2016

@Eschon
Copy link
Author

Eschon commented Jul 4, 2016

I'm not sure how to interpret your answer. Are you suggesting that I should try that instead of react-router-loader?

@Eschon
Copy link
Author

Eschon commented Jul 4, 2016

Ok sorry this has nothing todo with react-router-loader, it was an error on my side. I just noticed that i used a relative path for the bundle.js in my html file. Using an absolute path fixed the prolbem.

@Eschon Eschon closed this as completed Jul 4, 2016
@luqin
Copy link
Owner

luqin commented Jul 5, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants