I am using a library ( peerjs ) that references the 'navigator' object at import time. Is there any way to tell it that I don't want it to try and generate a static page or render the code server side? I tried setting dynamic='force-dynamic' but that didn't do the trick
This is the code that I believe is causing the problem:
export const dynamic = 'force-dynamic'
import Peer from "peerjs";
export default function(){
let p = new Peer();
return <></>
}
Generating static pages (4/8)
ReferenceError: navigator is not defined
at new <anonymous> (/vercel/path0/.next/server/app/call/page.js:7:121)
at 75414 (/vercel/path0/.next/server/app/call/page.js:1:95863)
at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
at F (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:91937)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94352
at W._fromJSON (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94790)
at JSON.parse (<anonymous>)
at N (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:91658)
at t (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:98043)