Issue: if I define pathPrefix, then my build is broken if I don't use the --prefix-paths flag. Everything works fine if I simply run gatsby develop
Expected:
I use pathPrefix because i upload to ghpages, but I still test the build locally, and I will occasionally use a staging server that does not need a prefix. So run gatsby build without the flag, and expect to be able to use gatsby serve without any issues.
What actually happens:
I tested two different gatsby projects, and both had issues when I defined a pathPrefix, but did not use the --prefix-paths flag. On one project, it would just redirect everything back to the index. On another project the page never loaded and the console spit out a 'TypeError: t is undefined' with a stack trace that isn't very helpful because it is a production build. In both cases, if I removed the pathPrefix line from my gatsby-config.js, and then ran gatsby build and gatsby serve, then everything would work.
Steps to reproduce
Define pathPrefix in a project's gatsby-config.js file, build, and serve (without using the --prefix-paths flag
@slightlyoffbeat I ran into the same problem, reported here: https://github.com/gatsbyjs/gatsby/issues/2551
@m-allanson this looks like it could indeed be the problem — could you put together a PR fixing the check?
@KyleAMathews Yep, will do. There's another PR that I want to get to first, I'm aiming to have time for both next week.
Hey, I also just noticed the same problem with the gatsby-advanced-starter. Is there a PR for this now?
I've not looked at this yet. If anyone else wants to jump in, please do.
@slightlyoffbeat This should be fixed in Gatsby v1.9.149.
@m-allanson awesome! I'll give it a try.
i have same problems. i use --prefix-paths and i defined pathPrefix.
my gatsby version is "gatsby": "^1.9.153",
but i have this issue!
Hey @milad1367 can you open a new issue for this?
Most helpful comment
@slightlyoffbeat This should be fixed in Gatsby v1.9.149.