I cannot transit to another page, Gatsby only loads one page.
index.jsabout.jslocalhost:8000 and try to navigate to /about/The about page loaded
The won't load
System:
OS: OS X El Capitan 10.11.6
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Shell: 5.0.8 - /bin/zsh
Binaries:
Node: 10.14.2 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 71.0.3578.98
Safari: 9.1.2
npmPackages:
gatsby: ^2.0.33 => 2.0.70
gatsby-plugin-typography: ^2.2.2 => 2.2.2
npmGlobalPackages:
gatsby-cli: 2.4.6
I discovered what was wrong, for any reason, the Gatsby actually only works if each page has a unique identifier name such as const Index = () => <div>Home</div>, and will not work if have two pages exporting something like export default () => <div>Home</div> and export default () => <div>About</div>, well is it.
I came across this issue trying to follow the tutorial https://www.gatsbyjs.org/tutorial/part-three/
I suppose that this is an issue that has recently been introduced.
@valtism @kaluabentes you're both correct.
I believe gatsbyjs/gatsby#10455 introduced a regression with develop mode regarding anonymous arrow functions.
I've created a reproduction of the issue here.
You can reproduce the issue by checking out that repo and running yarn start or npm start. You'll see the About page not the index route in develop mode.
If you run yarn add [email protected] (or npm i [email protected] --save) and re-run yarn develop the issue will go away.
I think we'll need to get a fix out early tomorrow morning or perhaps consider reverting that PR for the time being.
Thanks for bringing this to our attention!
Let me take a look from HotLoader prospective.
The issue is on Gatsby side. I'll comment on PR
@kaluabentes - try remove yarn.lock and then reinstall package. That would eventually update React-Hot-Loader from 4.6.1 to 4.6.2 and fix the problem.
Thank you guys for the feedback, the problem its already resolved using the method of naming identifiers and exporting them, Its nice to help improve Gatsby, congrats, its a nice tool.
@theKashey little confused; updating to 4.6.2 seems to do the trick (for me, at least). Is there more we should do from Gatsby's side, e.g. your comment in https://github.com/gatsbyjs/gatsby/pull/10455#issuecomment-448101330
If it's just a matter of bumping, I'll get a PR up bumping the minimum version in gatsby core and get this issue closed out 馃憣
The fix is available in [email protected]
To upgrade (and ensure no issue, even if using anonymous arrow functions) just explicitly install _at least_ the above version, e.g.
yarn add gatsby@^2.0.71
or
npm install gatsby@^2.0.71 --save
with ver. 2.0.73 hrm is not working, reverted back to 2.0.68 right now.
@pungggi can you provide more info? Seems to work just fine to me.
Do you perhaps have a lockfile that is pinning versions?
Most helpful comment
I discovered what was wrong, for any reason, the Gatsby actually only works if each page has a unique identifier name such as
const Index = () => <div>Home</div>, and will not work if have two pages exporting something likeexport default () => <div>Home</div>andexport default () => <div>About</div>, well is it.