Skip to content

Update docs for existing Next.js websites on Netlify to include basic build settings #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DaveBitter opened this issue May 4, 2021 · 6 comments
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@DaveBitter
Copy link

Is your feature request related to a problem? Please describe.
I had an existing site on Netlify that didn't use this awesome plugin yet where I just used Next.js static site generation (SSG). For that, you usually configure two deploy settings in Netlify:

  • Build command: npm run build && npm run export
  • Publish directory: out

What I didn't realize is that I needed to change the build command to just npm run build and leave the publish directory blank. It might be an obvious thing for people, but I couldn't find this documented anywhere.

Describe the solution you'd like
I think it would be great to document these two deploy settings in the README under Installation and Configuration -> UI-based installation for existing Next.js sites. I'm more than happy to pick this up.

Describe alternatives you've considered
An alternative is to close this issue and have it as a reference. I tried searching the issues for this and couldn't find it.

Additional context
n/A

Thanks for this awesome plugin!

@lindsaylevine lindsaylevine added the type: feature code contributing to the implementation of a feature and/or user facing functionality label May 5, 2021
@lindsaylevine
Copy link

@DaveBitter would love for you to open a PR with what you'd like to see!!!

@Nicoowr
Copy link

Nicoowr commented May 9, 2021

That'd be great!
On a side note, what you suggested did not work for me, I had to use a custom netlify.toml file, with this config to make it work:

[build]
command = "next build"
publish = ".next"

[[plugins]]
package = "@netlify/plugin-nextjs"

I also had to specify target: "serverless" in next.config.js

@lindsaylevine
Copy link

@Nicoowr

[build]
command = "npm run build"
publish = "out"

[[plugins]]
package = "@netlify/plugin-nextjs"

works for thousands of sites!

if you wanna send over a repo demonstrating that it doesnt work for you, id be happy to dig into it!

@lindsaylevine
Copy link

@DaveBitter hey dave are you wanting to open a PR for this? otherwise i can take care of it!

@Nicoowr
Copy link

Nicoowr commented May 17, 2021

@lindsaylevine yes it seems that the problem comes from our own website settings. I'll dig into it :)
Anyway, the mentioned config in the docs works for new apps from scratch!

@DaveBitter
Copy link
Author

I'm so sorry for responding this late! I see that you already merged a change to the docs. Perfect 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

3 participants