Uppy nextjs "document is not defined", how to make it work?

I’m trying to make uppy work in nextjs. Nextjs tries to render every page on the server first and will also evaluate and create bundles on the server. Uppy uses native browser APIs such as document and window which aren’t defined on the server.

Is there a way to make it work regardless?

Here’s a sandbox illustrating the problem: Next.js Starter - StackBlitz

Hi, this a Next.js problem, not one for Uppy, as there are many client-side only libraries and it’s up to the implementer in the framework to handle that correctly.

In your case this will probably solve it: