ReferenceError: firebase is not defined
See original GitHub issueAfter upgrading to NativeScript 2.5 I am not able to bundle with webpack. It works perfectly fine when running it with “tns run android” but when running with bundle I am not able to instantiate firebase.
I get my front screen but then nothing is loaded after trying to run firebase. I am simply importing it as defined here (import firebase = require(“nativescript-plugin-firebase”)).
I get the following error:
JS: ReferenceError: firebase is not defined
JS: at LoginPageComponent.module.exports.LoginPageComponent.ngOnInit (file:///data/data/org.nativescript.drivelogger
.student/files/app/bundle.js:22985:9)
JS: at Wrapper_LoginPageComponent.module.exports.Wrapper_LoginPageComponent.ngDoCheck (file:///data/data/org.natives
cript.drivelogger.student/files/app/bundle.js:54812:30)
JS: at View_LoginPageComponent_Host0.module.exports.View_LoginPageComponent_Host0.detectChangesInternal (file:///dat
a/data/org.nativescript.drivelogger.student/files/app/bundle.js:54854:38)
JS: at View_LoginPageComponent_Host0.module.exports.AppView.detectChanges (file:///data/data/org.nativescript.drivel
ogger.student/files/app/vendor.js:11439:14)
JS: at ViewContainer.module.exports.ViewContainer.detectChangesInNestedViews (file:///data/data/org.nativescript.dri
velogger.student/files/app/vendor.js:15719:37)
JS: at View_AppComponent0.module.exports.View_AppComponent0.detectChangesInternal (file:///data/data/org.nativescrip
t.drivelogger.student/files/app/bundle.js:53527:20)
JS: at View_AppComponent0.module.exports.AppView.detectChanges (file:///data/data/org.nativescript.drivelogger.stude
nt/files/app/vendor.js:11439:14)
JS: at View_AppComponent0.module.exports.AppView.internalDetectChanges (file:///data/data/org.nativescript.drivelogg
er.student/files/app/vendor.js:11424:18)
JS: at View_AppComponent_Host0.module.exports.View_AppComponent_Host0.detectChangesInternal (file:///data/data/org.n
ativescript.drivelogger.student/files/app/bundle.js:53493:25)
JS: at View_AppComponent_Host0.module.exports.AppView.detectChanges (file:///data/data/org.nativescript.drivelogger.
student/files/app/vendor.js:11439:14)
JS: ReferenceError: firebase is not defined
The command I am using to bundle is this: webpack --config=webpack.android.js --progress
And it works fine when I remove firebase from my login component.
Any ideas of how to get around this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Uncaught ReferenceError: Firebase is not defined
Uncaught ReferenceError: Firebase is not defined · This means that you didn't include the Firebase JavaScript library in your page yet. · Thank...
Read more >`Firebase is not defined` js error · Issue #65 - GitHub
15:04:07.673 ReferenceError: firebase is not defined <anonymous>firebase.html:18. I'm not using firebase serve though.
Read more >difficulties in firebase realtime database setup - Google Groups
I'm trying to start up a simple javascript web project using the firebase database, ... player.js:24 Uncaught ReferenceError: firebase is not defined.
Read more >Uncaught ReferenceError: firebase is not defined vue js-Vue.js
[Solved]-Uncaught ReferenceError: firebase is not defined vue js-Vue.js ... 2.Then add the messaging module in your project. E.g. index.js file. import 'firebase ...
Read more >Javascript – “Uncaught ReferenceError: Firebase is not defined”
I'm working with Firebase for the first time on a practice project and I'm having a very difficult time setting up the ability...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Where do you all initialize firebase? Is it in
main.ts
? Try initializing in theapp.component.ts
file.I moved all my initialization code to
app.component.ts
and all was well for me. I ran into a similar issue with the nativescript-google-maps-sdk.I fixed my webpack init in
main.aot.ts
issue with solution mentioned hereImporting the plugin this way:
import * as firebase from "nativescript-plugin-firebase"
instead of the way it’s mentioned on githubimport firebase = require("nativescript-plugin-firebase");
hope it helps