Fix window is not defined error during build

__PATH_PREFIX__ is always defined now, so checking for __PREFIX_PATHS__ isn't necessary any more. This fixes `gatsby build` for this branch.
This commit is contained in:
Mike Allanson 2018-06-20 22:43:05 +01:00 committed by GitHub
parent 7cae968420
commit a3028127b8
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