question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: firebase is not defined

See original GitHub issue

After 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:closed
  • Created 7 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ShawnPavelcommented, Apr 5, 2017

Where do you all initialize firebase? Is it in main.ts? Try initializing in the app.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.

0reactions
davorpeiccommented, Dec 8, 2017

I fixed my webpack init in main.aot.ts issue with solution mentioned here

Importing the plugin this way: import * as firebase from "nativescript-plugin-firebase" instead of the way it’s mentioned on github import firebase = require("nativescript-plugin-firebase");

hope it helps

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found