React-redux-starter-kit: Error after deploying to production

Created on 11 Jan 2016  路  8Comments  路  Source: davezuko/react-redux-starter-kit

I used NODE_ENV=production npm run compile. I have my ngnix configuration to redirect all traffic to dist/index.html and if i try to go to a url thats not the index, for example http://domain.com/about i get the following javascript error:
Uncaught SyntaxError: Unexpected token <

if i go the the index, http://domain.com/ and from there press a link to the about page it all works perfect.

any idea what can be wrong?

Most helpful comment

having this same issue with Firebase hosting. Not sure if config/_production.js is a legacy file, as it's not in my project, but the config/environments.js file has this:

production: (config) => ({
    compiler_public_path: '/',
    compiler_fail_on_warning: false,
    compiler_hash_type: 'chunkhash',
    compiler_devtool: null,
    compiler_stats: {
      chunks: true,
      chunkModules: true,
      colors: true
    }
  })

Is this what above posters were referring to re: compiler_public_path?

If so, is there another fix? like OP, <Link>ing from my index page works fine, but navigating directly there works not-fine.

All 8 comments

The issue was with me..
I added compiler_public_path : '/', to the config/_production.js and now all works perfect.

Had the same issue and the above fixed it. Hosting on firebase btw.

Would love to know if there is a more fundamental issue here.

Thanks

Have the same issue when hosted on AWS s3. I have set the compiler_public_path : '/', in config/_production.js and it doesn't work. I'm using the 1.0.0 version of the starter kit. Can anyone help ?

having this same issue with Firebase hosting. Not sure if config/_production.js is a legacy file, as it's not in my project, but the config/environments.js file has this:

production: (config) => ({
    compiler_public_path: '/',
    compiler_fail_on_warning: false,
    compiler_hash_type: 'chunkhash',
    compiler_devtool: null,
    compiler_stats: {
      chunks: true,
      chunkModules: true,
      colors: true
    }
  })

Is this what above posters were referring to re: compiler_public_path?

If so, is there another fix? like OP, <Link>ing from my index page works fine, but navigating directly there works not-fine.

I am facing the same issue @brandonmp . Did you find any solution?

ah sorry @abhinavzspace , i must have found a solution b/c it works fine now, but i genuinely can't remember at all what i did :/ if I can remember I'll update here

@abhinavzspace What kind of history you use with React router ?
When I got this kind of issue a while back, I was using browserHistory. I switched to hashHistory and everything worked perfectly.

Unfortunately, I have no clear idea why this is so. I'll have to take a deep dive into React router histories myself.

Thanks! I will try hashHistory and let you know.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orielz picture orielz  路  3Comments

postalservice14 picture postalservice14  路  4Comments

marcelloromanelli picture marcelloromanelli  路  5Comments

macnibblet picture macnibblet  路  3Comments

kolpav picture kolpav  路  4Comments