Skip to content

Commit

Permalink
Update spa template package.json script to use vite preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ngbrown committed Feb 3, 2024
1 parent 0cbcadb commit ea1bd1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions templates/spa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ When you are ready to build a production version of your app, `npm run build` wi
npm run build
```

Preview build locally with [vite preview](https://vitejs.dev/guide/cli#vite-preview) to serve all routes via the single `index.html` file. Do not use this as a production server as it's not designed for it:

```shellscript
npm run preview
```

You can serve this from any server of your choosing. The server should support SPA fallback. For a simple example, you could use [sirv-cli](https://www.npmjs.com/package/sirv-cli):

```shellscript
Expand Down
3 changes: 1 addition & 2 deletions templates/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
"build": "remix vite:build",
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "http-server build/client/",
"preview": "vite preview",
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/node": "*",
"@remix-run/react": "*",
"http-server": "^14.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down

0 comments on commit ea1bd1f

Please sign in to comment.