React router parametrized routes: SyntaxError: expected expression, got '<' React router parametrized routes: SyntaxError: expected expression, got '<' express express

React router parametrized routes: SyntaxError: expected expression, got '<'


I've got a react/react-router page without any express and got the same error:SyntaxError: expected expression, got '<' which started to appear as soon as I configured a react route other then just root /.

After some experimenting I've figured out that in my index.html there was a link to js file:

  <script src="bundle.js"></script></body></html>

So, the solution was to add / in the source path:

  <script src="/bundle.js"></script></body></html>

and the error has gone.

Hope that could help a bit.


After adding the / to bundle.js as this answer suggested the issue still persisted.

I was able to fix the issue by running rm -rf .cache in my project directory, as per this github issue.