I am using react 16
and react router 4
, webpack
and webpack dev server
.
I do have the following Route
:
<Route path="/company/:symbol" render={this.getCompanyPageRoute} />
And I do navigate to this route through the following:
this.props.history.push('/company/blablabla');
Everything works fine. But if I refresh the page with this URL, I get the following error:
Uncaught SyntaxError: Unexpected token <
I've seen that there are several posts of this error, but I was not albe to fix the issue following those links.
Posting the answer if it could help someone else.
Changing the output property of the webpack config to the following fixed the issue:
The trick is made by:
publicPath: '/'