Firebaseui-web: I use next2.js ssr can't import firebaseui

Created on 5 Jun 2017  路  3Comments  路  Source: firebase/firebaseui-web

ReferenceError: window is not defined
at /Users/user/Sites/demo/firebaseNext/node_modules/firebaseui/dist/npm.js:30:129
at Object. (/Users/user/Sites/demo/firebaseNext/node_modules/firebaseui/dist/npm.js:327:16)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/user/Sites/demo/firebaseNext/.next/dist/pages/index.js:15:19)

All 3 comments

The widget renders dynamically after the page loads, just call the javascript of this function on page load

Could you show an example of this? I am trying to do this but require is only defined within the server side

firebase UI does not support SSR in Next.js apps. One root cause is that we're relying on Material-design-lite which requires windows. SSR could still work theoretically by simulating a whole DOM but for things like react or next.js the best is to simply skip loading firebaseui on SSR.

Was this page helpful?
0 / 5 - 0 ratings