create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Production app only works when the homepage is left blank

Open timurtu opened this issue 9 years ago • 2 comments

App with the problem.

Using pushstate-server the browser looks for a non-existent /proverb-generator/static/js/main.916a0ac9.js file when my package.json says

...
"homepage": "http://timurtu.github.io/proverb-generator"
...

It loads when I build leaving the homepage blank

...
"homepage": ""
...

Using https://github.com/timurtu/proverb-generator as the homepage property fails with the same error.

I saw a similar issue where it will only work with http but this error still occurs after removing the s.

timurtu avatar Jan 03 '17 04:01 timurtu

Probably a duplicate of https://github.com/facebookincubator/create-react-app/issues/1335?

Scratch that.

gaearon avatar Jan 03 '17 10:01 gaearon

If you build for GH Pages you can’t use pushstate-server locally like this. It will assume files exist at / whereas they exist at /proverb-generator. For now this is working as designed: you can either build for / path (and use pushstate-server) or build for /proverb-generator (and deploy to GH Pages).

I know this is not super convenient and we’ll need to look into it again as part of solving https://github.com/facebookincubator/create-react-app/issues/1094. Please subscribe to that issue if you’re interested.

I’m closing this specific issue since it is not actionable at the moment. This is just how it works right now.

gaearon avatar Jan 03 '17 11:01 gaearon