- Paul Onteri
Table of Contents
yarn add -D @netlify/plugin-nextjs yarn add -D @netlify/plugin-nextjs
Place the following in the root of your project:
[[plugins]] package = "@netlify/plugin-nextjs" [build] command = "yarn next build" publish = ".next"
NETLIFY_SITE_ID environment variables
How to generate
Generate the access token manually in your Netlify user settings for Personal access tokens:
- Under Personal access tokens, select New access token.
- Enter a description.
- Select Generate token.
- Copy the generated token to your clipboard. Once you navigate from the page, the token cannot be seen again.
- Save the token as a NETLIFY_AUTH_TOKEN environment variable in your terminal settings or in the UI of a Continuous Integration (CI) tool.
The above can alternatively be done via the command line
How to find
This site ID can be found in the Netlify UI:
- Go to Site settings > General > Site details > Site information, and copy the value for API ID.
- Assign the ID to a
This can alternatively be done via the netlify link command.
Build and Deploy your Next.js application to Netlify
Deploying to production can be done via the following command:
netlify deploy --build --prod
Remember to add the build flag to the
netlify deploy command. This doesn't work:
netlify build && netlify deploy --prod