From 58a97ff774e9fc4ef0a561ae0a48e8dee122e965 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sat, 16 Nov 2019 15:13:05 -0500 Subject: [PATCH] disable SPA mode by default - closes #88 - and add instructions in README --- README.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ecd9d60..c740b88 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,17 @@ npm run build You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com). +## Single-page app mode + +By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere. + +If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json: + +```js +"start": "sirv public --single" +``` + + ## Deploying to the web ### With [now](https://zeit.co/now) diff --git a/package.json b/package.json index 3b40276..4e791f5 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,6 @@ "scripts": { "build": "rollup -c", "dev": "rollup -c -w", - "start": "sirv public --single" + "start": "sirv public" } }