From 9e72d3defbc3d73a8faf1a0811a40436a4f76f58 Mon Sep 17 00:00:00 2001 From: Garry Polley Date: Mon, 28 Dec 2020 20:10:14 -0600 Subject: [PATCH 1/5] Update netlify dev configuration recommendation Netlify dev works if you use customized settings in the toml file. --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e9d6e05..775c750 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ We're done. Let's deploy 🚀🚀🚀 I recommend you still use `next dev` to build and preview your application locally. -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. +But if you want to emulate the Netlify deployment on your computer, you can also run a cusotmized `netlify-cli` to preview the result. First, install the latest version of `netlify-cli` (you can also [look at package.json](https://github.com/netlify/next-on-netlify/blob/master/package.json) to see the version that next-on-netlify has been tested against): @@ -154,10 +154,10 @@ Then, add the following `[dev]` block to your `netlify.toml`: [dev] functions = "out_functions" publish = "out_publish" - # We manually set the framework to static, otherwise Netlify automatically - # detects Next.js and redirects do not work. - # Read more: https://github.com/netlify/cli/blob/master/docs/netlify-dev.md#project-detection - framework = "#static" + framework = "#custom" # necessary so netlify-dev allows the passthrough to your 3000 port + targetPort = 3000 # port your nextjs site is locally served from + port = 8888 # a nice port for you computer + command = "npm run dev" # The local next development command you use ``` Lastly, add the following lines to your `.gitignore`: @@ -174,7 +174,6 @@ Now you're all set. From now on, whenever you want to preview your application locally, just run: -1. `npm run build`: This will run `next build` to build your Next.js app and `next-on-netlify` to prepare your Next.js app for compatibility with Netlify 1. `netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888`. *Note:* From ec889789bc14279b14595267379b17f7f1f6a9a5 Mon Sep 17 00:00:00 2001 From: Garry Polley Date: Mon, 28 Dec 2020 20:11:45 -0600 Subject: [PATCH 2/5] Remove confusing wording from documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 775c750..5b1b9b3 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ We're done. Let's deploy 🚀🚀🚀 I recommend you still use `next dev` to build and preview your application locally. -But if you want to emulate the Netlify deployment on your computer, you can also run a cusotmized `netlify-cli` to preview the result. +But if you want to emulate the Netlify deployment on your computer, you can also run `netlify-cli` to preview the result. First, install the latest version of `netlify-cli` (you can also [look at package.json](https://github.com/netlify/next-on-netlify/blob/master/package.json) to see the version that next-on-netlify has been tested against): From fc4c3c55746c392a99f76cdad1bbbf2374dc9001 Mon Sep 17 00:00:00 2001 From: Garry Polley Date: Mon, 28 Dec 2020 20:19:38 -0600 Subject: [PATCH 3/5] Fix typo on you/your --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b1b9b3..0ac55d3 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ Then, add the following `[dev]` block to your `netlify.toml`: publish = "out_publish" framework = "#custom" # necessary so netlify-dev allows the passthrough to your 3000 port targetPort = 3000 # port your nextjs site is locally served from - port = 8888 # a nice port for you computer + port = 8888 # a nice port for your computer command = "npm run dev" # The local next development command you use ``` From b678e702adc5ff906ecaf2880691a59ceafd410b Mon Sep 17 00:00:00 2001 From: Garry Polley Date: Thu, 31 Dec 2020 15:53:56 -0600 Subject: [PATCH 4/5] Update with the `npx next-on-netlify` caveat --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0ac55d3..506c9b1 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ Now you're all set. From now on, whenever you want to preview your application locally, just run: +1. `npx next-on-netlify`: This ensures assets are in working order before starting the dev server 1. `netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888`. *Note:* From 5f5f21318d53a28a942b832fb1e43fdf9069a27e Mon Sep 17 00:00:00 2001 From: Garry Polley Date: Sat, 9 Jan 2021 21:06:22 -0600 Subject: [PATCH 5/5] show what is required for using netlify dev --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 506c9b1..8bebe72 100644 --- a/README.md +++ b/README.md @@ -174,8 +174,12 @@ Now you're all set. From now on, whenever you want to preview your application locally, just run: -1. `npx next-on-netlify`: This ensures assets are in working order before starting the dev server -1. `netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888`. +1. `npm run build`: First build your site and get all the files ready +1. `netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888` (initially this will show 404 page). +1. Open another terminal window +1. `npx next-on-netlify`: This ensures assets are in working order your `http://localhost:8888` should hot reload and show your application +1. Now you can edit your application locally -- you'll need to repeat these steps if you update a function + *Note:*