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

Fix JSON pages not building on Windows #611

Merged
merged 4 commits into from
Jan 2, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Check for .json file extension before JSON parse. Was throwing when r…
…eading js files.
  • Loading branch information
msand committed Jan 1, 2017
commit d67123615933175db0cd0d1728049c677692c807
12 changes: 8 additions & 4 deletions server/read-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ async function readPage (path) {
return cache[f]
}

const source = await fs.readFile(f, 'utf8')
const { component } = JSON.parse(source)
let content = await fs.readFile(f, 'utf8')

cache[f] = component
return component
if (f.slice(-5) === '.json') {
const { component } = JSON.parse(content)
content = component
}

cache[f] = content
return content
}

export default readPage
Expand Down