2
2
3
3
# Next.js Runtime
4
4
5
- <p align =" center " >
6
- <a aria-label =" npm version " href =" https://www.npmjs.com/package/@netlify/plugin-nextjs " >
7
- <img alt="" src="https://img.shields.io/npm/v/@netlify/plugin-nextjs">
8
- </a >
9
- <a aria-label =" MIT License " href =" https://img.shields.io/npm/l/@netlify/plugin-nextjs " >
10
- <img alt="" src="https://img.shields.io/npm/l/@netlify/plugin-nextjs">
11
- </a >
12
- </p >
13
-
14
- ## What's new in this version
15
-
16
- For full details of everything that's new, check out
17
- [ the v4 release notes] ( https://github.com/netlify/next-runtime/blob/main/docs/release-notes/v4.md )
5
+ Next.js is supported natively on Netlify, and in most cases you will not need to install or configure anything. This
6
+ repo includes the packages used to support Next.js on Netlify.
18
7
19
8
## Deploying
20
9
@@ -55,21 +44,9 @@ by targeting the `/_next/image/*` route:
55
44
56
45
## Next.js Middleware on Netlify
57
46
58
- Next.js Middleware works out of the box on Netlify, but check out the
59
- [ docs on some caveats] ( https://github.com/netlify/next-runtime/blob/main/docs/middleware.md ) . By default, middleware
60
- runs using SSR. For better results, you should enable [ Netlify Edge Functions] ( #netlify-edge-functions ) , which ensures
61
- middleware runs at the edge. To use Netlify Edge Functions for middleware or to enable
62
- [ edge server rendering] ( https://nextjs.org/blog/next-12-2#edge-server-rendering-experimental ) , set the environment
63
- variable ` NEXT_USE_NETLIFY_EDGE ` to ` true ` .
64
-
65
- ### No nested middleware in Next 12.2.0
66
-
67
- In Next 12.2.0, nested middleware [ has been deprecated] ( https://nextjs.org/docs/messages/middleware-upgrade-guide ) in
68
- favor of root level middleware. If you are not using edge functions then this means that you won't get the benefits of
69
- using a CDN, and ISR will not work.
70
-
71
- To fix this issue, you can run your middleware on [ Netlify Edge Functions] ( #netlify-edge-functions ) by setting the
72
- environment variable ` NEXT_USE_NETLIFY_EDGE ` to ` true ` .
47
+ Next.js Middleware works out of the box on Netlify. By default, middleware runs using Netlify Edge Functions. For legacy
48
+ support for running Middleware at the origin, set the environment variable ` NEXT_DISABLE_NETLIFY_EDGE ` to ` true ` . Be
49
+ aware that this will result in slower performance, as all pages that match middleware must use SSR.
73
50
74
51
## Monorepos
75
52
@@ -127,11 +104,12 @@ package = "@netlify/plugin-nextjs"
127
104
128
105
## Manually upgrading from an older version of the Next.js Runtime
129
106
130
- If you previously set these values, they're no longer needed and can be removed:
107
+ If you previously set these values, they're no longer needed and should be removed:
131
108
132
109
- ` distDir ` in your ` next.config.js `
133
110
- ` node_bundler = "esbuild" ` in ` netlify.toml `
134
111
- ` external_node_modules ` in ` netlify.toml `
112
+ - The environment variable ` NEXT_USE_NETLIFY_EDGE ` can be removed as this is now the default
135
113
136
114
The ` serverless ` and ` experimental-serverless-trace ` targets are deprecated in Next 12, and all builds with this Next
137
115
Runtime will now use the default ` server ` target. If you previously set the target in your ` next.config.js ` , you should
@@ -144,5 +122,6 @@ files must be placed in `public`, not in the root of the site.
144
122
145
123
## Feedback
146
124
147
- If you think you have found a bug in this repo, [ please open an issue] ( https://github.com/netlify/next-runtime/issues ) .
148
- If you have comments or feature requests, [ see the dicussion board] ( https://github.com/netlify/next-runtime/discussions )
125
+ If you think you have found a bug in Next.js on Netlify,
126
+ [ please open an issue] ( https://github.com/netlify/next-runtime/issues ) . If you have comments or feature requests,
127
+ [ see the discussion board] ( https://github.com/netlify/next-runtime/discussions )
0 commit comments