Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit ff9ccd5

Browse files
committed
README: Update instructions for local preview
The latest version of Netlify (v2.51.0 or higher) comes with a built-in server, so there is no need for installing our own.
1 parent df2eca1 commit ff9ccd5

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

README.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ I recommend you still use `next dev` to build and preview your application local
7575

7676
But if you want to emulate the Netlify deployment on your computer, you can also run `next-on-netlify` locally and then use `netlify-cli` to preview the result.
7777

78-
To do that, first install `http-server` and `netlify-cli`:
79-
```
80-
npm install --save-dev http-server
78+
First, install `netlify-cli` v2.51.0 or later:
79+
80+
```bash
8181
npm install -g netlify-cli
8282
```
8383

84-
Then add the following `[dev]` block to your `netlify.toml`:
84+
Then, add the following `[dev]` block to your `netlify.toml`:
8585

8686
```toml
8787
# netlify.toml
@@ -90,10 +90,6 @@ Then add the following `[dev]` block to your `netlify.toml`:
9090
# ...
9191

9292
[dev]
93-
# We use HTTP server without directory listings (-d false),
94-
# without caching (-c-1), and without log output (--silent).
95-
# More info: https://www.npmjs.com/package/http-server
96-
command = "http-server --port 3999 -d false -c-1 --silent"
9793
functions = "functions"
9894
publish = "public"
9995
# We manually set the framework to static, otherwise Netlify automatically
@@ -102,7 +98,8 @@ Then add the following `[dev]` block to your `netlify.toml`:
10298
framework = "#static"
10399
```
104100

105-
And add the following lines to your `.gitignore`:
101+
Lastly, add the following lines to your `.gitignore`:
102+
106103
```shell
107104
# .gitignore
108105

@@ -115,9 +112,8 @@ public/_redirects
115112
Now you're all set.
116113

117114
From now on, whenever you want to preview your application locally, just run:
118-
1. `next build` to build your NextJS app
119-
1. then `next-on-netlify` to prepare it for compatibility with Netlify
120-
1. and then `netlify dev` to preview your app as if it was hosted on Netlify
115+
1. `npm run build`: This will run `next build` to build your NextJS app and `next-on-netlify` to prepare your NextJS app for compatibility with Netlify
116+
1. `netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888`.
121117

122118
#### Add Custom Redirects
123119

0 commit comments

Comments
 (0)