From ab913862ac4552007524a0dab7909fbc5a4efcf7 Mon Sep 17 00:00:00 2001 From: Emil Bay Date: Wed, 24 Jun 2015 18:05:41 +0200 Subject: [PATCH] Fix `--pushstate` when `index.html` exists This fixes #11 --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d0ddc17..d4a1cb5 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,10 @@ module.exports.static = function(opts) { var indexHtmlHandler = function(req, res, params) { fs.exists(path.join(basedir, 'index.html'), function(exists) { var firstEntry = opts.entries[0].to - if (exists) return staticHandler(req, res) + if (exists) { + req.url = '/index.html' + return staticHandler(req, res) + } else module.exports.generateIndex(firstEntry, req, res) }) }