From 57a9135769a4daec0ade68436d55fbca20786cea Mon Sep 17 00:00:00 2001 From: Sidhartha Chatterjee Date: Wed, 30 Jan 2019 03:12:36 +0530 Subject: [PATCH 1/2] Always respond with index html without checking path --- packages/gatsby/src/commands/develop.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/gatsby/src/commands/develop.js b/packages/gatsby/src/commands/develop.js index 5b4e5c58b28d8..b8f4a6407f6fe 100644 --- a/packages/gatsby/src/commands/develop.js +++ b/packages/gatsby/src/commands/develop.js @@ -187,20 +187,11 @@ async function startServer(program) { // Render an HTML page and serve it. app.use((req, res, next) => { - const parsedPath = parsePath(req.path) - if ( - parsedPath.extname === `` || - parsedPath.extname.startsWith(`.html`) || - parsedPath.path.endsWith(`/`) - ) { - res.sendFile(directoryPath(`public/index.html`), err => { - if (err) { - res.status(500).end() - } - }) - } else { - next() - } + res.sendFile(directoryPath(`public/index.html`), err => { + if (err) { + res.status(500).end() + } + }) }) /** From 62b5433976f2f099c8166d12c947b2bc6a8be29b Mon Sep 17 00:00:00 2001 From: Sidhartha Chatterjee Date: Wed, 30 Jan 2019 03:28:21 +0530 Subject: [PATCH 2/2] Remove parse-filepath --- packages/gatsby/package.json | 1 - packages/gatsby/src/commands/develop.js | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index c2468473bd2b0..bd108ed6af536 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -96,7 +96,6 @@ "null-loader": "^0.1.1", "opentracing": "^0.14.3", "optimize-css-assets-webpack-plugin": "^5.0.1", - "parse-filepath": "^1.0.1", "physical-cpu-count": "^2.0.0", "postcss-flexbugs-fixes": "^3.0.0", "postcss-loader": "^2.1.3", diff --git a/packages/gatsby/src/commands/develop.js b/packages/gatsby/src/commands/develop.js index b8f4a6407f6fe..4497781142c41 100644 --- a/packages/gatsby/src/commands/develop.js +++ b/packages/gatsby/src/commands/develop.js @@ -9,7 +9,6 @@ const express = require(`express`) const graphqlHTTP = require(`express-graphql`) const graphqlPlayground = require(`graphql-playground-middleware-express`) .default -const parsePath = require(`parse-filepath`) const request = require(`request`) const rl = require(`readline`) const webpack = require(`webpack`)