EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 442 forks source link

Build fail on nativescript 7 #1696

Open tigerdi opened 4 years ago

tigerdi commented 4 years ago

I have NS7 and everything is working properly, but when I try to build for release I get this error:

ERROR in node_modules/@nativescript/firebase/messaging/messaging.d.ts:1:10 - error TS2305: Module '"../firebase"' has no exported member 'Message'.

1 import { Message, MessagingOptions } from '../firebase';
           ~~~~~~~
node_modules/@nativescript/firebase/messaging/messaging.d.ts:1:19 - error TS2305: Module '"../firebase"' has no exported member 'MessagingOptions'.

1 import { Message, MessagingOptions } from '../firebase';

I am using the new @nativescript/firebase plugin, and have used the following import in app.component.ts:

import { firebase } from '@nativescript/firebase';

I have looked at the file in question (messaging.d.ts), and the intellisense is showing there is no exported member for Message or MessagingOptions, even though I can see them being exported in the firebase.d.ts file.

This is stopping me from being able to push a new version live. Any ideas?

tylerablake commented 4 years ago

I have 2 projects, both using "@nativescript/firebase": "11.0.0",. 1 project works fine, the other gets the same error, I will investigate into why 1 is working and the other is not. Can you post your package.json?

tigerdi commented 4 years ago

Sure:

"dependencies": {
    "@angular/animations": "10.1.4",
    "@angular/common": "10.1.4",
    "@angular/compiler": "10.1.4",
    "@angular/core": "10.1.4",
    "@angular/forms": "10.1.4",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "10.1.4",
    "@angular/platform-browser-dynamic": "10.1.4",
    "@angular/router": "10.1.4",
    "@nativescript/angular": "10.1.5",
    "@nativescript/core": "7.0.3",
    "@nativescript/firebase": "^11.0.0",
    "@nativescript/webpack": "3.0.0",
    "@nstudio/nativescript-loading-indicator": "^4.0.0",
    "@nstudio/nativescript-pulltorefresh": "^3.0.1",
    "email-validator": "^2.0.4",
    "nativescript-appversion": "^1.4.1",
    "nativescript-carousel": "^7.0.1",
    "nativescript-email": "^1.5.1",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-ngx-fonticon": "^4.1.0",
    "nativescript-permissions": "^1.3.8",
    "nativescript-ui-listview": "7.0.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "~6.5.5",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular/cli": "~10.1.4",
    "@angular/compiler-cli": "~10.1.4",
    "@nativescript/ios": "7.0.1",
    "@nativescript/schematics": "^0.6.0",
    "@nativescript/types": "7.0.0",
    "@ngtools/webpack": "~10.1.4",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "typescript": "3.9.7"
  },

Many thanks

tylerablake commented 4 years ago

Ok so I got it working, I did a few things so I'm not sure which one solved the issue but here are some things to try.

  1. In your nativescript.config.ts remove these lines if they exist:

    appPath: 'src',
    useLegacyWorkflow: false,
  2. In your tsconfig.json add this line : "skipLibCheck": true,

Also double check that your other plugins are up to date, it wouldn't be the root cause of this issue but could be causing issues during the build process.

Let me know what happens, I can continue to assist if needed.

tigerdi commented 4 years ago

None of the nativescript.config.ts things applied to mine, but adding "skipLibCheck": true to tsconfig.json seems to have worked. I did think there must be an option for Typescript to ignore these false errors, and completely forgot about this option.

Many thanks!

tylerablake commented 4 years ago

No problem, happy to help! Happy NativeScripting!

span commented 3 years ago

This "solved" the issue in #1729 as well. Although not validating libraries does not seem like a good way to go and it is beyond me why it does not validate but "works".

tylerablake commented 3 years ago

@span I agree, using that flag is definitely not the long term goal, but it can help especially in this case since the NS 7 upgrade also upgraded the TS versions. Some plugins haven't been updated for the new TS version yet.

mloaizau commented 3 years ago

Replace: import { Message } from "@nativescript/firebase";

with: import { firebase } from "@nativescript/firebase";

And update the references to Message to be firebase.Message

this work for me