firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.62k stars 1.06k forks source link

SSR bypass compilation errors #790

Open afriedma opened 3 years ago

afriedma commented 3 years ago

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

Steps to reproduce:

ng run jbs:app-shell

Relevant Code:

I am using SSR with firebase auth and getting the above error during compilation. I pretty printed the code that fails, see below

var __WEBPACK_AMD_DEFINE_RESULT__;
(function() {
        var firebase = __webpack_require__( /*! firebase/app */ "Wcq6");
        __webpack_require__( /*! firebase/auth */ "CMMD");
        if (typeof firebase.default !== 'undefined') {
            firebase = firebase.default;
        }(function() {
            var supportCustomEvent = window.CustomEvent;
            if (!supportCustomEvent || typeof supportCustomEvent === "object") {
                supportCustomEvent = function CustomEvent(event, x) {
                    x = x || {};
                    var ev = document.createEvent("CustomEvent");
                    ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null);
                    return ev
                };
                supportCustomEvent.prototype = window.Event.prototype
            }

Could you please advise? I tried adding domino, but its still fails to compile. My package.json below, thank you in advance for your help.

"dependencies": { "@angular/animations": "~10.2.0", "@angular/cdk": "^10.2.5", "@angular/common": "~10.2.0", "@angular/compiler": "~10.2.0", "@angular/core": "~10.2.0", "@angular/fire": "^6.1.2", "@angular/flex-layout": "^10.0.0-beta.32", "@angular/forms": "~10.2.0", "@angular/material": "^10.2.5", "@angular/platform-browser": "~10.2.0", "@angular/platform-browser-dynamic": "~10.2.0", "@angular/platform-server": "~10.2.0", "@angular/router": "~10.2.0", "@angular/service-worker": "~10.2.0", "firebase": "^8.0.2", "firebaseui": "^4.7.1", "firebaseui-angular": "^5.1.1", "ng-navigator-share": "^1.0.4", "ngx-bottom-nav": "^0.5.0", "pwacompat": "^2.0.17", "quagga": "^0.12.1", "rxjs": "~6.6.0", "tslib": "^2.0.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/architect": ">= 0.900 < 0.1100", "@angular-devkit/build-angular": "~0.1002.0", "@angular-devkit/build-optimizer": "^0.1100.1", "@angular/cli": "~10.2.0", "@angular/compiler-cli": "~10.2.0", "@types/jasmine": "~3.5.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", "codelyzer": "^6.0.0", "colors": "^1.4.0", "dotenv": "^8.2.0", "firebase-tools": "^8.0.0", "fuzzy": "^0.1.3", "gulp": "^4.0.2", "gulp-load-plugins": "^2.0.5", "gulp-purifycss": "^0.2.0", "gulp-responsive": "^3.0.1", "gzipper": "^4.3.0", "inquirer": "^6.2.2", "inquirer-autocomplete-prompt": "^1.0.1", "jasmine-core": "~3.6.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~5.0.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "open": "^7.0.3", "protractor": "~7.0.0", "ts-node": "~8.3.0", "tslint": "~6.1.0", "typescript": "~4.0.2" }

Stack trace below


Unhandled Promise rejection: window is not defined ; Zone: <root> ; Task: Promise.then ; Value: ReferenceError: window is not defined
    at C:\Development\latest\foo\dist\prj\server\main.js:130022:263
    at C:\Development\latest\foo\dist\prj\server\main.js:130048:232
    at Object.WC58 (C:\Development\latest\foo\dist\prj\server\main.js:130471:383)
    at __webpack_require__ (C:\Development\latest\foo\dist\prj\server\main.js:26:30)
afriedma commented 3 years ago

Does my question makes no sense? Can someone please comment? Thank you.

coleridge72 commented 2 years ago

Anyone know of any ways around this?

homiebaby12 commented 2 years ago

``

emarceenyusef commented 12 months ago

hi @afriedma have you found any solution?