Next.js 12 fails to render page that uses Uppy

I’m struggling to get Uppy to work after recently upgrading to Next.js 12 and React 18.
When running next start. Any page that calls useUppy results in a blank page and a console error.
Uncaught SyntaxError: Unexpected identifier pointing to this line

I have added a unique id to the Uppy plugin, as the error message suggests.

This does not occur when I run next dev.

Any help or ideas would be most appreciated.

Are you server-side rendering Uppy? I don’t think that’s possible. Seems you are re-adding a plugin somehow, resulting in this crash. Are you initializing Uppy correctly?

Turns out this is a problem when Next.js minifies the code. See: Nextjs 12 fails to render any page that uses Uppy, getting error Uncaught SyntaxError: Unexpected identifier · Issue #3736 · transloadit/uppy · GitHub

I didn’t get this error eith Next12 and minify enabled… Are you using the useUppy() hook to instanciate the Uppy instance?

I’ve struggled to get it to work too, and I wrote my problems and solution here