@@ -31,6 +31,12 @@ npm install -D @netlify/plugin-nextjs
31
31
package = " @netlify/plugin-nextjs"
32
32
```
33
33
34
+ ## Deploying
35
+
36
+ If you build on Netlify, this plugin will work with no additional configuration. However if you are building and
37
+ deploying locally using the Netlify CLI, you must deploy using ` netlify deploy --build ` . Running the
38
+ build and deploy commands separately will not work, because the plugin will not generate the required configuration.
39
+
34
40
## Migrating from an older version of the plugin
35
41
36
42
You can manually upgrade from the previous version of the plugin by running the following command:
58
64
59
65
If you currently use redirects or rewrites on your site, see
60
66
[ the Rewrites and Redirects guide] ( https://github.com/netlify/netlify-plugin-nextjs/blob/main/docs/redirects-rewrites.md )
61
- for information on changes to how they are handled in this version.
67
+ for information on changes to how they are handled in this version. In particular, note that ` _redirects ` and ` _headers `
68
+ files must be placed in ` public ` , not in the root of the site.
62
69
63
70
If you want to use Next 12's beta Middleware feature, this will mostly work as expected but please
64
71
[ read the docs on some caveats and workarounds] ( https://github.com/netlify/netlify-plugin-nextjs/blob/main/docs/middleware.md )
@@ -85,6 +92,20 @@ you can remove it. Alternatively you can
85
92
support. See [ ` demos/next-export ` ] ( https://github.com/netlify/netlify-plugin-nextjs/tree/main/demos/next-export ) for an
86
93
example.
87
94
95
+ ## Asset optimization
96
+
97
+ Netlify [ asset optimization] ( https://docs.netlify.com/site-deploys/post-processing/ ) should not be used with Next.js
98
+ sites. Assets are already optimized by Next.js at build time, and doing further optimization can break your site. Ensure
99
+ that it is not enabled at ** Site settings > Build & deploy > Post processing > Asset optimization** .
100
+
101
+ ## Generated functions
102
+
103
+ This plugin works by generating three Netlify functions that handle requests that haven't been pre-rendered. These are
104
+ ` ___netlify-handler ` (for SSR and API routes), ` ___netlify-odb-handler ` (for ISR and fallback routes), and ` _ipx ` (for
105
+ images). You can see the requests for these in [ the function logs] ( https://docs.netlify.com/functions/logs/ ) . For ISR
106
+ and fallback routes you will not see any requests that are served from the edge cache, just actual rendering requests.
107
+ These are all internal functions, so you won't find them in your site's own functions directory.
108
+
88
109
## Feedback
89
110
90
111
If you think you have found a bug in the plugin,
0 commit comments