You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-30
Original file line number
Diff line number
Diff line change
@@ -11,49 +11,85 @@
11
11
</a>
12
12
</p>
13
13
14
-
This build plugin is a utility for enabling server-side rendering in Next.js on Netlify. It wraps your application in a tiny compatibility layer, so that pages can use Netlify Functions to be server-side rendered.
14
+
This build plugin is a utility for supporting Next.js on Netlify. To enable server-side rendering and other framework-specific features in your Next.js application on Netlify, you will need to install this plugin for your app.
15
15
16
16
## Table of Contents
17
17
18
18
-[Installation and Configuration](#installation-and-configuration)
-[Fallbacks for Pages with `getStaticPaths`](#fallbacks-for-pages-with-getstaticpaths)
23
23
-[Credits](#credits)
24
24
-[Showcase](#showcase)
25
25
26
26
## Installation and Configuration
27
27
28
-
Create a `netlify.toml` in the root of your project:
28
+
Create a `netlify.toml` in the root of your project. Your file should include:
29
+
30
+
```toml
31
+
[build]
32
+
command = "npm run build"
33
+
34
+
[[plugins]]
35
+
package = "@netlify/plugin-nextjs"
36
+
```
37
+
38
+
Read more about [file-based plugin installation](https://docs.netlify.com/configure-builds/build-plugins/#file-based-installation) in our docs.
39
+
This plugin can also be installed and managed from your site's settings on Netlify.
40
+
If you want to install there, you can omit this [[plugins]] section from your `netlify.toml` file.
41
+
42
+
## Custom Netlify Functions
43
+
44
+
This plugin creates one Netlify Function for each Next.js page that requires one.
45
+
To use custom Netlify Functions in addition to what the plugin generates, add a path to your functions folder in `netlify.toml`:
29
46
30
47
```toml
31
48
[build]
32
49
command = "npm run build"
33
-
functions = "out_functions"
34
-
publish = "out_publish"
50
+
functions = "my_functions_dir"
35
51
36
52
[[plugins]]
37
53
package = "@netlify/plugin-nextjs"
38
54
```
39
55
56
+
Read more about [Netlify Functions](https://docs.netlify.com/functions/overview/) in our docs.
57
+
58
+
## Publish Directory
59
+
60
+
Similarly, you can customize your publish directory in your `netlify.toml` file:
61
+
62
+
```toml
63
+
[build]
64
+
command = "npm run build"
65
+
functions = "my_functions_dir"
66
+
publish = "my_publish_dir"
67
+
68
+
[[plugins]]
69
+
package = "@netlify/plugin-nextjs"
70
+
```
71
+
72
+
Read more about [Netlify's build settings](https://docs.netlify.com/configure-builds/get-started/#basic-build-settings) in our docs.
73
+
40
74
## Custom Netlify Redirects
41
75
42
-
You can define custom redirects in a `_redirects`and/or in your `netlify.toml`file.
76
+
You can define custom redirects in a `_redirects` file.
43
77
The precedence of these rules are:
44
78
45
79
-`_redirects`
46
80
-`next-on-netlify` redirects
47
-
-`netlify.toml`
48
81
49
-
[Read more about Netlify redirects here](https://docs.netlify.com/routing/redirects/).
82
+
Read more about [Netlify redirects](https://docs.netlify.com/routing/redirects/) in our docs.
50
83
51
-
## Custom Netlify Functions
84
+
## Caveats
52
85
53
-
`next-on-netlify` creates one Netlify Function for each of your
54
-
SSR pages and API endpoints. It is currently not possible to create custom Netlify Functions. Let me know if you have a need for this feature and we can add it.
86
+
### Versions
55
87
56
-
## Caveats
88
+
You can check our `package.json` for supported Next and Node versions. Our support of Next 10 is currently experimental.
89
+
90
+
### CLI
91
+
92
+
This plugin is currently not stable for use with the Netlify CLI. Support for the plugin is in development.
57
93
58
94
### Fallbacks for Pages with `getStaticPaths`
59
95
@@ -65,21 +101,7 @@ For more on this, see: [Issue #7](https://github.com/netlify/next-on-netlify/iss
65
101
66
102
## Credits
67
103
68
-
This package is maintained by [Lindsay Levine](https://github.com/lindsaylevine), [Finn Woelm](https://github.com/FinnWoelm), and [Cassidy Williams](https://github.com/cassidoo).
69
-
70
-
📣 Shoutout to [@mottox2](https://github.com/mottox2) (a pioneer of hosting Next.js on Netlify) and [@danielcondemarin](https://github.com/danielcondemarin) (author of serverless-next.js for AWS). The two were big inspirations for this package.
71
-
72
-
🙌 Big "thank you" to the following people for their contributions, support, and beta testing:
73
-
74
-
-[@spencewood](https://github.com/spencewood)
75
-
-[@alxhghs](https://github.com/alxhghs)
76
-
-[@gamliela](https://github.com/gamliela)
77
-
-[@wei](https://github.com/wei)
78
-
-[@laugharn](https://github.com/laugharn)
79
-
-[@rajington](https://github.com/rajington)
80
-
-[@etrepum](https://github.com/etrepum)
81
-
-[@jonasbuntinx](https://github.com/jonasbuntinx)
82
-
-[@joostmeijles](https://github.com/joostmeijles)
104
+
This package is maintained by [Lindsay Levine](https://github.com/lindsaylevine) and [Cassidy Williams](https://github.com/cassidoo). It extends the project [next-on-netlify](https://github.com/netlify/next-on-netlify), authored originally by [Finn Woelm](https://github.com/finnwoelm).
83
105
84
106
## Showcase
85
107
@@ -90,5 +112,3 @@ The following sites are built with `next-on-netlify`:
0 commit comments