Using the Next.js out folder in Netlify causes an error from today on

The best output of a 100% static Next.js build is the `out` folder. While the default is the .next folder, the out folder will give you a site with better performance!


Hosting on Netlify

We host some of our sites on Netlify but since last night we’re receiving build errors for every deploy. The title of the error is: Plugin "@netlify/plugin-nextjs" failed. That’s quite weird, because we don’t use this plugin! Luckily, the explanation of the error also gives the correct solution:

Your publish directory is set to "out", but in most cases it should be ".next".
If you are using "next export" then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".

This is the case for us. I do have to say, we didn’t expect a breaking change like this to be implemented without any warning.

Solution

So, if you also host a static Next.js site on Netlify and use the output of the out folder, add an environment variable called NETLIFY_NEXT_PLUGIN_SKIP with the value true. You can do this within the deploy settings within the tab environment-variables.