Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(live-server): content.toString() crash (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored and danbucholtz committed Oct 30, 2017
1 parent f498382 commit 07e7e05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dev-server/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function serveIndex(req: express.Request, res: express.Response) {
// respond with the index.html file
const indexFileName = path.join(config.wwwDir, process.env[Constants.ENV_VAR_HTML_TO_SERVE]);
fs.readFile(indexFileName, (err, indexHtml) => {
if (!indexHtml) {
Logger.error(`Failed to load index.html`);
res.send('try again later');
return;
}
if (config.useLiveReload) {
indexHtml = injectLiveReloadScript(indexHtml, req.hostname, config.liveReloadPort);
indexHtml = injectNotificationScript(config.rootDir, indexHtml, config.notifyOnConsoleLog, config.notificationPort);
Expand Down

0 comments on commit 07e7e05

Please sign in to comment.