Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Step 11 tutorial missing step #218

Open
yarnball opened this issue Aug 17, 2016 · 7 comments
Open

Step 11 tutorial missing step #218

yarnball opened this issue Aug 17, 2016 · 7 comments

Comments

@yarnball
Copy link
Contributor

Great tutorial! Thank you :)

Step 11 seems to be missing something. I keep getting the error:

Uncaught SyntaxError: Unexpected token < (bundle.js:1)

I'm pretty sure the cause is that it's missing:

publicPath: '/'

from webpack.config.js

  output: {
    path: 'public',
    filename: 'bundle.js',
    publicPath: '/'
  },
@timdorr
Copy link
Member

timdorr commented Aug 23, 2016

Yep, that looks to be a small oversight. Can you submit a PR to fix it?

yarnball added a commit to yarnball/react-router-tutorial that referenced this issue Aug 24, 2016
timdorr pushed a commit that referenced this issue Sep 21, 2016
@spik3s
Copy link

spik3s commented Sep 26, 2016

Small fix, now that publicPath: '/' is declared, the snippet of code

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

contains also path: 'public' which should be declared later on in the tutorial. Otherwise, it will keep returning the Unexpected token < (bundle.js:1) error.

@kylanhurt
Copy link

Thanks a ton for the heads-up guys.

@eurobob
Copy link

eurobob commented Dec 7, 2016

the path: 'public' issue that spik3s pointed out is still an issue. Tripped me up at least

@dloret
Copy link

dloret commented Dec 8, 2016

Correct, the issue persists if webpack.config.js is not amended in a similar way at this first step of booting a prod server:
output: { /*path: "public",*/ filename: "bundle.js", publicPath: "/" },

@spik3s: thanks.

@merriam
Copy link

merriam commented Mar 21, 2017

To add a bit more information:

  1. The error is from Express not finding ./public/bundle.js because it is looking for ./bundle.js. It keeps looping back until it just tries to deal with index.html. See http://stackoverflow.com/questions/38743275/express-js-unexpected-token.

  2. Moving bundle.js from ./public to . will make the error disappear.

  3. One way to move bundle.js is not to put in the "path: 'public'" line until after this step. This also keeps the public directory from being created, which makes the next step of the tutorial break.

The only remaining issue is updating the path in webpack .config.js is now listed twice, so those following the tutorial will still get stuck. Adding a PR.

@merriam
Copy link

merriam commented Mar 21, 2017

If we apply PR #310, we can close #229, #242, #280, #282, #289, and #291. Everyone runs across this bug.

gitpash pushed a commit to gitpash/ReactTraining that referenced this issue Apr 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants