nativescript-plugin-firebase icon indicating copy to clipboard operation
nativescript-plugin-firebase copied to clipboard

Build fail on nativescript 7

Open tigerdi opened this issue 4 years ago • 8 comments

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?

tigerdi avatar Oct 07 '20 12:10 tigerdi

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?

tylerablake avatar Oct 07 '20 14:10 tylerablake

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

tigerdi avatar Oct 07 '20 15:10 tigerdi

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,
  1. 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.

tylerablake avatar Oct 07 '20 17:10 tylerablake

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!

tigerdi avatar Oct 07 '20 18:10 tigerdi

No problem, happy to help! Happy NativeScripting!

tylerablake avatar Oct 07 '20 18:10 tylerablake

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".

span avatar Dec 13 '20 21:12 span

@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.

tylerablake avatar Dec 14 '20 16:12 tylerablake

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

mloaizau avatar Jul 12 '21 16:07 mloaizau