Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build is broken if you define pathPrefix, but don't use the --prefix-paths flag. #2740

Closed
slightlyoffbeat opened this issue Nov 1, 2017 · 9 comments

Comments

@slightlyoffbeat
Copy link

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

@m-allanson
Copy link
Contributor

@slightlyoffbeat I ran into the same problem, reported here: #2551

@KyleAMathews
Copy link
Contributor

@m-allanson this looks like it could indeed be the problem — could you put together a PR fixing the check?

@m-allanson
Copy link
Contributor

@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.

@Kageetai
Copy link

Kageetai commented Dec 5, 2017

Hey, I also just noticed the same problem with the gatsby-advanced-starter. Is there a PR for this now?

@m-allanson
Copy link
Contributor

I've not looked at this yet. If anyone else wants to jump in, please do.

@m-allanson
Copy link
Contributor

@slightlyoffbeat This should be fixed in Gatsby v1.9.149.

@slightlyoffbeat
Copy link
Author

@m-allanson awesome! I'll give it a try.

@milad1367
Copy link

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!

@m-allanson
Copy link
Contributor

Hey @milad1367 can you open a new issue for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants