Next.js Discord

Discord Forum

How do i import lib without running in SSR to prevent error messages in cli

Unanswered
Basset Hound posted this in #help-forum
Open in Discord
Basset HoundOP
const messaging = dynamic(() => import('@/lib/firebase/firebase'), { ssr: false }); doesnt seem to work

Argument of type '() => Promise<typeof import("c:/Users/mail/Project/planplay/lib/firebase/firebase")>' is not assignable to parameter of type 'DynamicOptions<{}> | Loader<{}>'. Type '() => Promise<typeof import("c:/Users/mail/Project/planplay/lib/firebase/firebase")>' is not assignable to type '() => LoaderComponent<{}>'. Type 'Promise<typeof import("c:/Users/mail/Project/planplay/lib/firebase/firebase")>' is not assignable to type 'LoaderComponent<{}>'. Type 'typeof import("c:/Users/mail/Project/planplay/lib/firebase/firebase")' is not assignable to type 'ComponentType<{}> | ComponentModule<{}>'.

I need to disable ssr for that because i get errors in the nextjs cli console.

0 Replies