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
{{ message }}
This repository was archived by the owner on May 10, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,14 +30,14 @@
30
30
## 2.0.0 (2020-06-02)
31
31
32
32
-**Breaking: You must change your `netlify.toml` configuration for next-on-netlify v2.0.0.** Please [look at the README](https://github.com/netlify/next-on-netlify#3-configure-netlify) for the latest configuration.
33
-
`next-on-netlify` now builds pre-rendered pages and static assets in `out_publish`. Netlify Functions for SSR pages are built to `out_functions`.
33
+
`next-on-netlify` now builds pre-rendered pages and static assets in `out_publish`. Netlify Functions for SSR pages are built to `out_functions`.
34
34
- Add support for `getStaticProps` ([#7](https://github.com/netlify/next-on-netlify/issues/7))
35
35
- Add support for `getStaticPaths` with and without fallback ([#7](https://github.com/netlify/next-on-netlify/issues/7))
36
36
- Add support for `getServerSideProps` ([#7](https://github.com/netlify/next-on-netlify/issues/7))
37
37
- Query string parameters are now correctly passed to Next Pages and API endpoints ([#9](https://github.com/netlify/next-on-netlify/issues/9))
38
38
- Response headers are now correctly set ([#9](https://github.com/netlify/next-on-netlify/issues/9#issuecomment-633288179))
39
39
- When a user encounters a 404, `next-on-netlify` now display the NextJS 404 page rather than Netlify's default 404 page. You can [customize the NextJS 404 page](https://nextjs.org/docs/advanced-features/custom-error-page#customizing-the-404-page).
- Every page with server-side rendering is now converted to a stand-alone Netlify Function. Previously, all SSR pages were bundled in a single Netlify Function.
42
42
-`next-on-netlify` now prints out which pages are being converted to Netlify Functions for SSR, which pages are served as pre-rendered HTML, and the redirects that are being generated.
43
43
- Adding custom redirects via a `_redirects` file in the project root is no longer supported. Let me know if you want this back. Or define your redirects in `netlify.toml`.
Copy file name to clipboardExpand all lines: README.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,25 @@ Principal Developer Experience Engineer at Netlify, will be joining
21
21
22
22
next-on-netlify is a utility for hosting NextJS applications with Server-Side Rendering on Netlify. It wraps your NextJS application in a tiny compatibility layer, so that pages can be server-side rendered with Netlify functions.
23
23
24
-
- Demo: https://next-on.netlify.com/
24
+
- Demo: https://next-on.netlify.com/
25
25
- Example repository: https://github.com/FinnWoelm/next-on-netlify-demo
26
26
27
27
## Table of Contents
28
-
*[Installation](#installation)
29
-
*[Setup](#setup)
30
-
-[1. Set NextJS target to serverless](#1-set-nextjs--target-to-serverless)
28
+
29
+
-[Installation](#installation)
30
+
-[Setup](#setup)
31
+
-[1. Set NextJS target to serverless](#1-set-nextjs--target-to-serverless)
We must build our NextJS app as a serverless app. You can read more about serverless NextJS [here](https://nextjs.org/docs/api-reference/next.config.js/build-target#serverless-target).
54
55
@@ -59,13 +60,13 @@ It's super simple. Just create a `next.config.js` file and write the following:
59
60
60
61
module.exports= {
61
62
// Target must be serverless
62
-
target:'serverless'
63
+
target:"serverless",
63
64
};
64
65
```
65
66
66
67
#### 2. Add postbuild hook
67
68
68
-
The next-on-netlify package adds the `next-on-netlify`command. When we run this command, some magic happens to prepare our NextJS app for hosting on Netlify*.
69
+
The next-on-netlify package adds the `next-on-netlify` command. When we run this command, some magic happens to prepare our NextJS app for hosting on Netlify\*.
69
70
70
71
We want the next-on-netlify command to run after we build our NextJS application. So let's add a postbuild hook to our package.json file:
71
72
@@ -140,6 +141,7 @@ Lastly, add the following lines to your `.gitignore`:
140
141
Now you're all set.
141
142
142
143
From now on, whenever you want to preview your application locally, just run:
144
+
143
145
1.`npm run build`: This will run `next build` to build your NextJS app and `next-on-netlify` to prepare your NextJS app for compatibility with Netlify
144
146
1.`netlify dev`: This will emulate Netlify on your computer and let you preview your app on `http://localhost:8888`.
145
147
@@ -152,7 +154,7 @@ The precedence of these rules are:
152
154
-`next-on-netlify` redirects
153
155
-`netlify.toml`
154
156
155
-
[Read more about Netlify redirects here](https://docs.netlify.com/routing/redirects/).
157
+
[Read more about Netlify redirects here](https://docs.netlify.com/routing/redirects/).
156
158
157
159
#### Custom Netlify Functions
158
160
@@ -165,7 +167,6 @@ SSR pages and API endpoints. It is currently not possible to create custom Netli
165
167
166
168
[NextJS Preview Mode](https://nextjs.org/docs/advanced-features/preview-mode) does not work on pages that are pre-rendered (pages with `getStaticProps`). Netlify currently does not support cookie-based redirects, which are needed for supporting preview mode on pre-rendered pages. Preview mode works correctly on any server-side-rendered pages (pages with `getInitialProps` or `getServerSideProps`). See: [Issue #10](https://github.com/netlify/next-on-netlify/issues/10)
167
169
168
-
169
170
### Fallbacks for Pages with `getStaticPaths`
170
171
171
172
[Fallback pages](https://nextjs.org/docs/basic-features/data-fetching#fallback-true) behave differently with `next-on-netlify` than they do with NextJS. On NextJS, when navigating to a path that is not defined in `getStaticPaths`, it first displays the fallback page. NextJS then generates the HTML in the background and caches it for future requests.
@@ -188,6 +189,7 @@ Are you building something awesome with `next-on-netlify`? 🔥 Let me know and
188
189
📣 Shoutout to [@mottox2](https://github.com/mottox2) (a pioneer of hosting NextJS on Netlify) and [@danielcondemarin](https://github.com/danielcondemarin) (author of serverless-next.js for AWS). The two were big inspirations for this package.
189
190
190
191
🙌 Big "thank you" to the following people for their contributions, support, and beta testing:
0 commit comments