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

--prefix-paths flag is always enabled #2551

Closed
m-allanson opened this issue Oct 20, 2017 · 5 comments · Fixed by #3233
Closed

--prefix-paths flag is always enabled #2551

m-allanson opened this issue Oct 20, 2017 · 5 comments · Fixed by #3233

Comments

@m-allanson
Copy link
Contributor

Setting a pathPrefix in gatsby-config.js will cause gatsby build to use that path prefix in all production builds - i.e.gatsby build and gatsby build --prefix-paths produce the same output.

This means that sites built with gatsby build will have broken navigation and trigger errors in the browser console.

screen shot 2017-10-20 at 12 15 08

It looks like this is caused by an unexpected value in the equality check in loader.js. __PREFIX_PATHS__ is a ReferenceError instead of undefined. This causes the pathPrefix to be used, resulting in Gatsby being unable to match window paths with its own list of paths.

I'm a bit hazy on the precise differences between a ReferenceError and undefined, but hopefully this is enough info for someone to track down the problem.

screen shot 2017-10-20 at 12 06 20

I've created an example repo (based on gatsby's default starter) that demonstrates the problem at https://github.com/m-allanson/gatsby-path-prefix-test

@hemantsan
Copy link

I am also getting this same issue. Anyone has a fix ?

@m-allanson
Copy link
Contributor Author

@vieckys this should have been fixed a while ago. Are you using a recent version of Gatsby?

@hemantsan
Copy link

hemantsan commented Mar 28, 2018

@m-allanson hmm it may be 2 - 3 months old.

@m-allanson
Copy link
Contributor Author

m-allanson commented Mar 28, 2018 via email

@JimLynchCodes
Copy link
Contributor

I'm getting the opposite- neither gatsby build nor gatesby build --prefix-paths add the prefix to my url: greglobinski/gatsby-starter-hero-blog#54

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

Successfully merging a pull request may close this issue.

3 participants