Im working on an App with Nativescript Angular and code sharing. After upgrading to Angular 10 a few days ago all worked fine. Today I wanted to implement Firebase with the plugin nativescript-plugin-firebase but as I try to run my app I get the following Error:
ERROR in ../node_modules/nativescript-plugin-firebase/firebase.js
Module not found: Error: Can't resolve 'tns-core-modules/application/application'
ERROR in ../node_modules/nativescript-plugin-firebase/messaging/messaging.js
Module not found: Error: Can't resolve 'tns-core-modules/application/application'
ERROR in ../node_modules/nativescript-plugin-firebase/admob/admob.js
Module not found: Error: Can't resolve 'tns-core-modules/platform/platform'
ERROR in ../node_modules/nativescript-plugin-firebase/messaging/messaging.js
Module not found: Error: Can't resolve 'tns-core-modules/platform/platform'
I assume it is thrown by Webpack because it is logged during webpack compiling. My package.json looks somewhat like this:
{
"name": "application-name",
"nativescript": {
"id": "my.nativescript.app",
"tns-ios": {
"version": "6.5.2"
},
"tns-android": {
"version": "6.5.3"
}
},
"version": "0.0.0",
"scripts": {
// some scripts
},
"dependencies": {
"@angular/animations": "~10.0.0",
"@angular/common": "~10.0.0",
"@angular/compiler": "~10.0.0",
"@angular/core": "~10.0.0",
"@angular/forms": "~10.0.0",
"@angular/platform-browser": "~10.0.0",
"@angular/platform-browser-dynamic": "~10.0.0",
"@angular/router": "~10.0.0",
"@nativescript/angular": "~10.0.0",
"@nativescript/core": "rc",
"@nativescript/theme": "~2.2.1",
"core-js": "^2.6.9",
"nativescript-plugin-firebase": "^10.5.2",
"reflect-metadata": "~0.1.12",
"rxjs": "~6.5.5",
"tslib": "1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.2",
"@angular/cli": "~10.0.0",
"@angular/compiler-cli": "~10.0.0",
"@nativescript/tslint-rules": "~0.0.5",
"@nativescript/webpack": "~2.0.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"node-sass": "^4.7.1",
"protractor": "~5.4.3",
"tns-platform-declarations": "^6.5.15",
"ts-node": "~8.3.0",
"tslint": "^5.20.1",
"typescript": "~3.9.0"
}
}
Just to understand the error I tried changing the import in the mentioned files to tns-core-modules/application and so on. The compiling worked but the app crashed as soon as I started it on my Simulator. I also tried @nativescript/core/application/application. I got the same Error.
I don't have any clue how to fix this problem so I would appreciate every help I could get.