react-textarea-autosize: [v8] SSR support is broken
It seems, like with introduction of v8 this issue has returned
We are using this package with next v11.0.1 and getting the following error, when trying to start our application:
“ReferenceError: document is not defined”
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 11
- Comments: 17 (6 by maintainers)
I’m running into this problem when using the Next.js Edge Runtime with SSR as well.
I ran into this issue using react-router v7 on Cloudflare Workers. The fix for me was to add
workertossr.resolve.conditionsin myvite.config.ts:This is because react-textarea-autosize has the
workerconditional export, but I had to tell Vite to look for that.Thanks. Unfortunately throws an error while generating the og image on
api/ogroute in next.js:Probably because
satoripackage is incompatible with theworkercondition?SSR should not reach for
react-textarea-autosize.browser.esm.js. This is a browser build - this means that your bundler is configured incorrectly.