From 858ed15f645d8b2cdbacae45134f747fa305537c Mon Sep 17 00:00:00 2001 From: Hrishikesh Kokate Date: Fri, 25 Nov 2022 22:34:20 +0530 Subject: [PATCH 1/2] Added additional manual installation method --- README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b4d524707a..59e396258f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ by targeting the `/_next/image/*` route: ## Disabling included image loader -If you wish to disable the use of the image loader which is bundled into the runtime by default, set the `DISABLE_IPX` environment variable to `true`. +If you wish to disable the use of the image loader which is bundled into the runtime by default, set the `DISABLE_IPX` environment variable to `true`. This should only be done if the site is not using `next/image` or is using a different loader (such as Cloudinary or Imgix). @@ -60,7 +60,7 @@ For more details on Next.js Middleware with Netlify, see the [middleware docs](h ### Limitations -Due to how the site configuration is handled when it's run using Netlify Edge Functions, data such as `locale` and `defaultLocale` will be missing on the `req.nextUrl` object when running `netlify dev`. +Due to how the site configuration is handled when it's run using Netlify Edge Functions, data such as `locale` and `defaultLocale` will be missing on the `req.nextUrl` object when running `netlify dev`. However, this data is available on `req.nextUrl` in a production environment. @@ -107,7 +107,21 @@ Edge runtime or middleware is enabled it will also generate edge functions for m ## Manually installing the Next.js Runtime -The Next.js Runtime installs automatically for new Next.js sites on Netlify. You can also install it manually like this: +The Next.js Runtime installs automatically for new Next.js sites on Netlify. You can also install it manually in the +following ways: + +### From the UI (Recommended): + +You can go to: + +```text +https://app.netlify.com/teams/slug/plugins/@netlify/plugin-nextjs/install +``` + +and choose the site to install the Next.js Runtime on. Make sure to replace `slug` with your team's slug. This method +is recommended because you will benefit from auto-upgrades to important fixes and feature updates. + +### From `npm`: ```shell npm install -D @netlify/plugin-nextjs @@ -117,9 +131,11 @@ npm install -D @netlify/plugin-nextjs ```toml [[plugins]] -package = "@netlify/plugin-nextjs" + package = "@netlify/plugin-nextjs" ``` +This method is recommended if you wish to pin the Next.js Runtime to a specific version. + ## Manually upgrading from an older version of the Next.js Runtime If you previously set these values, they're no longer needed and should be removed: @@ -139,7 +155,7 @@ information on changes to how they are handled in this version. In particular, n files must be placed in `public`, not in the root of the site. ## Using with pnpm -If your site uses pnpm to manage dependencies, currently you must [enable public hoisting](https://pnpm.io/npmrc#public-hoist-pattern). +If your site uses pnpm to manage dependencies, currently you must [enable public hoisting](https://pnpm.io/npmrc#public-hoist-pattern). The simplest way to do this is to create a `.npmrc` file in the root of your project with the content: ```ini From 5b2ca03b317d70bec7353da993bfc3cb3f5139c0 Mon Sep 17 00:00:00 2001 From: Hrishikesh Kokate Date: Wed, 30 Nov 2022 22:34:21 +0530 Subject: [PATCH 2/2] Incorporated feedback --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 59e396258f..10774b845d 100644 --- a/README.md +++ b/README.md @@ -112,13 +112,7 @@ following ways: ### From the UI (Recommended): -You can go to: - -```text -https://app.netlify.com/teams/slug/plugins/@netlify/plugin-nextjs/install -``` - -and choose the site to install the Next.js Runtime on. Make sure to replace `slug` with your team's slug. This method +You can go to the [UI](https://app.netlify.com/plugins/@netlify/plugin-nextjs/install) and choose the site to install the Next.js Runtime on. This method is recommended because you will benefit from auto-upgrades to important fixes and feature updates. ### From `npm`: