Unexpected token error

Hey all, having trouble setting up webpack with my project. I’m getting the error:
Uncaught SyntaxError: Unexpected token <
I’ll include a link to the relevant branch on GitHub at the end, but here’s a brief description.
The webpack config file is in the root directory. The client folder holds index.html as well as a build folder that holds the bundled js file. The server file holds our server file (using node and express). Ultimately, localhost3000 finds bundle.js, but returns the error I’ve included above.
Here’s a link: https://github.com/mmurkidjanian/plex/tree/test/server/

Author: Fantashit

2 thoughts on “Unexpected token error

  1. FYI, after some debugging, I found the issue was due to my express server thinking the contents of the bundle were the contents of the application’s index.html page. See a complete solution write-up on SO. Hope this helps someone else in the future.

  2. For what it’s worth – I was getting this error when deploying the webpack bundle using nginx static.

    I mis configured the path for the app and nginx was configured to send index.html as a fallback. Since the path was misconfigured, there was no real css or js to send so it sent index.html for all requests. Including for ‘text/css’ and the javascripts which caused this error.

Comments are closed.