angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.67k stars 2.19k forks source link

Angular SSR + PWA + i18n + @angular/fire to deploy throw error ENOENT: no such file or directory, rename index.html -> index.original.html #2757

Closed juliocardosoventura closed 3 years ago

juliocardosoventura commented 3 years ago

Version info

Angular: "@angular/common": "~11.1.2", "@angular/compiler": "~11.1.2", "@angular/core": "~11.1.2", "@angular/fire": "^6.1.4", "@angular/platform-browser": "~11.1.2", "@angular/platform-browser-dynamic": "~11.1.2", "@angular/platform-server": "~11.1.2", "@angular/router": "~11.1.2", "@angular/service-worker": "~11.1.2", "@nguniversal/express-engine": "^11.1.2", "@angular/cli": "~11.1.4", "@angular/compiler-cli": "~11.1.2", "@angular/localize": "^11.1.2" "@nguniversal/builders": "^11.1.2",

Firebase: "firebase": "^7.0 || ^8.0"

AngularFire: "@angular/fire": "^6.1.4"

Other (e.g. Ionic/Cordova, Node, browser, operating system): node -v v10.23.3

How to reproduce these conditions

Im creating a project with Angular SSR, PWA, i18n and i want to deploy with firebase but got this error ENOENT: no such file or directory, rename 'dist/my-app/dist/my-app/browser/index.html' -> 'dist/my-app/dist/my-app/browser/index.original.html'

firebase.json: { "hosting": [ { "target": "my-app", "public": "dist/my-app/dist/my-app/browser/en", "ignore": [ "/." ], "headers": [ { "source": ".[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].+(css|js)", "headers": [ { "key": "Cache-Control", "value": "public,max-age=31536000,immutable" } ] } ], "rewrites": [ { "source": "", "function": "ssr" } ] } ], "functions": { "source": "dist/my-app" } }

angular.json { "projects": { "my-app": { "i18n": { "sourceLocale": { "baseHref": "", "code": "en" }, "locales": { "es": { "translation": "src/locale/messages.es.xlf", "baseHref": "" } } } } }

server.ts

const distFolder = join(process.cwd(), browser/${process.env.NODE_Lang ? process.env.NODE_Lang : 'en'}/); const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';

Debug output

ENOENT: no such file or directory, rename 'dist/my-app/dist/my-app/browser/index.html' -> 'dist/my-app/dist/my-app/browser/index.original.html'

google-oss-bot commented 3 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.