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

[1.0] building with prefix-link creates runtime err #1106

Closed
craigmulligan opened this issue Jun 5, 2017 · 11 comments
Closed

[1.0] building with prefix-link creates runtime err #1106

craigmulligan opened this issue Jun 5, 2017 · 11 comments

Comments

@craigmulligan
Copy link

craigmulligan commented Jun 5, 2017

Pretty strange, when building with the prefix flag this runtime error

Running in dev mode or without the prefix flag I don't see it. Wondering if anyone else has encountered this or has ideas on the root cause?

@craigmulligan craigmulligan changed the title 1.0 building with prefix-link creates runtime err [1.0] building with prefix-link creates runtime err Jun 5, 2017
@craigmulligan
Copy link
Author

gatsby version : "1.0.0-alpha19-alpha.62172e76"

@secretfader
Copy link

secretfader commented Jun 5, 2017

prefixLink is no more in 1.0. Instead, use the gatsby-link component and everything should just work.

If you're already using the Link component and the build is still broken, share your package.json and I can dig more.

@craigmulligan
Copy link
Author

Hey @nicholaswyoung, yea I'm using the gatsby-link the interesting thing is that it's generating the link prefix (my scripts don't 404), it just creates the ^ side effect error.

I have two custom transformer plugins, but not sure that they are to blame cause everything works without prefix.

{
  "name": "landr",
  "version": "0.0.0",
  "description": "Experimental Static site generator",
  "homepage": "https://github.com/resin-io/landr",
  "repository": {
    "type": "git",
    "url": "git@github.com:resin-io/landr.git"
  },
  "scripts": {
    "start": "gatsby develop",
    "build": "gatsby build",
    "build:prefix": "gatsby build --prefix-links",
    "deploy": "npm run build:prefix && gh-pages -d public"
  },
  "dependencies": {
    "bootstrap": "4.0.0-alpha.6",
    "gatsby": "canary",
    "gatsby-link": "canary",
    "gatsby-plugin-postcss-sass": "canary",
    "gatsby-source-filesystem": "canary",
    "gatsby-transformer-readme": "0.0.0",
    "gatsby-transformer-changelog": "0.0.0",
    "react-addons-css-transition-group": "^15.5.2",
    "react-addons-transition-group": "^15.5.2",
    "react-transition-group": "^1.1.3",
    "reactstrap": "^4.6.2"
  },
  "devDependencies": {
    "gh-pages": "1.0.0"
  }
}

@jbolda jbolda added the v1 label Jun 5, 2017
@KyleAMathews
Copy link
Contributor

Do you know what component t is? Perhaps disable uglify in the webpack config so you can more easily identify it.

@craigmulligan
Copy link
Author

Here's the un uglified error.

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: boolean. Check the render method of `Route`

@KyleAMathews
Copy link
Contributor

Thanks, testing this.

@KyleAMathews
Copy link
Contributor

I added a linkPrefix to the gatsby-starter-blog and built it with gatsby build --prefix-links and it built just fine. Could you create a simple reproduction of the problem you're seeing?

Do you have a Route component in your project?I added a linkPrefix to the gatsby-starter-blog and built it with gatsby build --prefix-links and it built just fine. Could you create a simple reproduction of the problem you're seeing?

Do you have a Route component in your project?

@craigmulligan
Copy link
Author

Hey @KyleAMathews thanks for testing this, but it's not a build error, it's a browser runtime err which I think must have to do with when gatsby is building the routes. (I don't have any Route component in my app)

I've reproduced with gatsby-starter-blog see here: https://craig-mulligan.github.io/gatsby-starter-blog/, all I changed was the prefix link: gatsbyjs/gatsby-starter-blog#32

@KyleAMathews
Copy link
Contributor

Hmm ok see it now. Going to work today on how we're loading code into the browser anyways so will tackle this as part of that.

KyleAMathews added a commit that referenced this issue Jun 12, 2017
 #1106

Also added an example site for path prefixing and fixed
some bugs.
@KyleAMathews
Copy link
Contributor

Just added an example site + some fixes for path prefixing in #1155

Will merge and release soon.

KyleAMathews added a commit that referenced this issue Jun 13, 2017
* Change linkPrefix to pathPrefix to make link/path usage consistent fixes #1106

Also added an example site for path prefixing and fixed
some bugs.

* Update tests

* More bug fixing

* Remove console.log

* handle pathnames with hashes

* Force asynchronicity
@craigmulligan
Copy link
Author

Thanks that fixed 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

4 participants