Merge pull request #106 from gatsbyjs/m-allanson-patch-1

Fix `window is not defined` error during build
This commit is contained in:
Michal Piechowiak 2018-06-21 11:52:30 +02:00 committed by GitHub
commit 4a3683b9e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,16 +6,9 @@ import { rhythm, scale } from '../utils/typography'
class Template extends React.Component {
render() {
const { location, children } = this.props
const rootPath = `${__PATH_PREFIX__}/`
let header
let rootPath = `/`
if (
typeof window.__PREFIX_PATHS__ !== `undefined` &&
window.__PREFIX_PATHS__
) {
rootPath = window.__PATH_PREFIX__ + `/`
}
if (location.pathname === rootPath) {
header = (
<h1