-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native federation angular and firebase #650
Comments
I've run into this issue recently and I solved it by adding
You will still be able to import and use
The reason for this issue occuring might be that |
@vladimirs-puzanovs-vr Thank you for the suggestion. The point though, is to initialize the firebase app once when bootstrapping the skeleton app and use it across all the federated apps. We do this with module federation and Angular 14 and it works really well. I am trying to understand if it will be possible to do this with an app where we use only standalone components. |
Same problem here and unfortunately @vladimirs-puzanovs-vr workaround dind't work for me My setup: app.config.ts export const appConfig: ApplicationConfig = {
providers: [
provideFirebaseApp(() => initializeApp({...})),
provideAuth(() => getAuth()),
]
} federation.config.js const { withNativeFederation, shareAll } = require('@angular-architects/native-federation/config');
module.exports = withNativeFederation({
shared: {
...shareAll({ singleton: true, strictVersion: false, requiredVersion: 'auto' }),
},
skip: [
'rxjs/ajax',
'rxjs/fetch',
'rxjs/testing',
'rxjs/webSocket',
'firebase/app',
'firebase/messaging',
'juice',
'fs'
// Add further packages you don't need at runtime
]
}); angular.json {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"template-vazio": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-architects/native-federation:build",
"options": {},
"configurations": {
"production": {
"target": "template-vazio:esbuild:production"
},
"development": {
"target": "template-vazio:esbuild:development",
"dev": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-architects/native-federation:build",
"options": {
"target": "template-vazio:serve-original:development",
"rebuildDelay": 0,
"dev": true,
"port": 0
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "template-vazio:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"esbuild": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/template-vazio",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js",
"es-module-shims"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/@xtr/utilities/src/styles/xtr-styles.scss",
"node_modules/@nebular/theme/styles/prebuilt/default.css",
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve-original": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "template-vazio:esbuild:production"
},
"development": {
"buildTarget": "template-vazio:esbuild:development"
}
},
"defaultConfiguration": "development",
"options": {
"port": 4200
}
}
}
}
},
"cli": {
"analytics": false
}
} package.json {
"name": "template-vazio",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular-architects/native-federation": "^17.1.8",
"@angular/animations": "^17.3.0",
"@angular/cdk": "^17.1.0",
"@angular/common": "^17.3.0",
"@angular/compiler": "^17.3.0",
"@angular/core": "^17.3.0",
"@angular/elements": "^17.3.12",
"@angular/fire": "^17.1.0",
"@angular/forms": "^17.3.0",
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"@nebular/date-fns": "^13.0.0",
"@nebular/eva-icons": "file:F:/nebular/dist/eva-icons",
"@nebular/theme": "^13.0.0",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
"@xtr/auth": "^0.0.5-beta",
"@xtr/ckeditor": "^2.1.19",
"@xtr/ckeditor6": "^0.0.2",
"@xtr/utilities": "file:D:/xtr/xtr-npm-libraries/dist/xtr/utilities",
"@xtr/xtr-anexos": "^2.0.5",
"date-fns": "^2.0.0",
"es-module-shims": "^1.5.12",
"eva-icons": "^1.0.0",
"firebase": "^10.14.1",
"fs": "^0.0.1-security",
"juice": "^11.0.0",
"ngx-toastr": "^18.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.3.10",
"@angular/cli": "^17.3.10",
"@angular/compiler-cli": "^17.3.0",
"@schematics/angular": "^17.3.10",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.2"
}
} Got this error with the workaround
And this is the original error
|
@ericaugusto-git Did you find a solution? |
sadly no, our team decided to create an angular library instead of using native federation for now, hopefully @manfredsteyer well take a look at this in the future :( |
I am trying to create an angular project to work with the Firebase (@angular/fire) and Native Federation in an NX Monorepo.
This is my setup:
tsconfig.base.json
package.json
app.config.ts
app.routes.ts
app.component.ts
project.json
When I run the application through nx run broker-bi:serve-original it runs as expected but with no native federation. When I run it through nx run broker-bi:serve I get the following error:
What am I dong wrong?
The text was updated successfully, but these errors were encountered: