Repository navigation
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimefreq2: mediumtype: bug/fix
Milestone
Description
🐞 bug report
Is this a regression?
Yes, this is a regression
Description
AngularFire works well with v7 and v8 without Ivy, but turning on Ivy prevents me from doing builds.
🔬 Minimal Reproduction
https://github.com/StephenFluin/ivy-firebase-repro/commits/master
- Create new app
- Add firebase & realtime database
- Update to v8 (works)
- Turn on Ivy (fails)
🔥 Exception or Error
$ ng build --prod --source-map
10% building 3/3 modules 0 active 10% building 3/4 modules 1 active ...ce/te 10% building 3/4 modules 1 active ...ce/test/my-firebase-app/ 3 3 92%
Date: 2019-04-16T20:25:06.901Z - Hash: 9f64d91c0f0234d69e04 - Time: 29315ms
1 unchanged chunks
chunk {0} runtime-es5.741402d1d47331ce975c.js, runtime-es5.741402d1d47331ce975c.js.map (runtime) 1.47 kB [entry] [rendered]
chunk {2} polyfills-es5.db1ca970d93c3d6854ef.js, polyfills-es5.db1ca970d93c3d6854ef.js.map (polyfills) 111 kB [initial] [rendered]
chunk {3} styles.3f414165053c69a0bfa1.css, styles.3f414165053c69a0bfa1.css.map (styles) 59 bytes [initial] [rendered]
WARNING in ./src/app/app.component.ts 24:200-222
"export 'AngularFireDatabase' (imported as 'i1') was not found in '@angular/fire/database'
WARNING in ./src/app/app.component.ts 44:38-60
"export 'AngularFireDatabase' (imported as 'i1') was not found in '@angular/fire/database'
WARNING in ./src/app/app.module.ts 24:16-41
"export 'AngularFireDatabaseModule' was not found in '@angular/fire/database'
WARNING in ./src/app/app.module.ts 30:48-73
"export 'AngularFireDatabaseModule' was not found in '@angular/fire/database'
WARNING in ./src/app/app.module.ts 48:20-45
"export 'AngularFireDatabaseModule' was not found in '@angular/fire/database'
WARNING in ./src/app/app.module.ts 30:26-46
"export 'AngularFireModule' (imported as 'i1') was not found in '@angular/fire'
WARNING in ./src/app/app.module.ts 16:16-33
"export 'AngularFireModule' was not found in '@angular/fire'
WARNING in ./src/app/app.module.ts 40:20-37
"export 'AngularFireModule' was not found in '@angular/fire'
ERROR in ./node_modules/@angular/fire/__ivy_ngcc__/index.js
Module not found: Error: Can't resolve './public_api' in '/usr/local/google/home/stephenfluin/workspace/test/my-firebase-app/node_modules/@angular/fire/__ivy_ngcc__'
ERROR in ./node_modules/@angular/fire/__ivy_ngcc__/database/index.js
Module not found: Error: Can't resolve './public_api' in '/usr/local/google/home/stephenfluin/workspace/test/my-firebase-app/node_modules/@angular/fire/__ivy_ngcc__/database'
ERROR in chunk main [initial]
main-es5.b02852a167e1fde953ab.js
/usr/local/google/home/stephenfluin/workspace/test/my-firebase-app/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--16-0!/usr/local/google/home/stephenfluin/workspace/test/my-firebase-app/node_modules/@ngtools/webpack/src/index.js!/usr/local/google/home/stephenfluin/workspace/test/my-firebase-app/src/main.ts 77d72dccf0f5f5a9ddce59dbb9489804
Cannot read property 'isProvided' of null
🌍 Your Environment
Angular Version:
Angular CLI: 8.0.0-beta.15
Node: 11.10.0
OS: linux x64
Angular: 8.0.0-beta.12
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.0-beta.15
@angular-devkit/build-angular 0.800.0-beta.15
@angular-devkit/build-optimizer 0.800.0-beta.15
@angular-devkit/build-webpack 0.800.0-beta.15
@angular-devkit/core 8.0.0-beta.15
@angular-devkit/schematics 8.0.0-beta.15
@angular/@types
@angular/cli 8.0.0-beta.15
@angular/events
@angular/fire 5.1.2
@angular/firebase
@angular/rxjs
@angular/source-map
@angular/tslib
@angular/typescript
@ngtools/webpack 8.0.0-beta.15
@schematics/angular 8.0.0-beta.15
@schematics/update 0.800.0-beta.15
rxjs 6.4.0
typescript 3.4.3
webpack 4.29.6
Reacted by Sarun Intaralawan and Lorenzo Montanari
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimefreq2: mediumtype: bug/fix
Activity
m-henderson commentedon Apr 21, 2019
@StephenFluin have you looked into the issue at all and could maybe provide your findings? If not, no big deal(: would save me some legwork
JoostK commentedon Apr 21, 2019
Initial findings are that the CLI will first kickof ngcc with
"browser", "module", "main", resulting in the ES5 sources being analyzed and because it is the first request, will also update the.d.tsfiles.That is all fine, however the ES5 analysis ends up completely empty. I found using
ts.Program.getSourceFiles().map(sf => sf.fileName).filter(n => n.endsWith('.js'))that the program's sources only included the entry point'sindex.js, its import to./public_apiwas not within the list.So, what is going on? Some more debugging let me to the root problem here: the typing files and JS source files are all located in the same directory. Hence, when TypeScript resolves
./public_apiits module resolution system will end up with./public_api.d.ts! Hence, the actually interesting source files that ngcc needs to process never become part of the analysis program; causing ngcc to conclude there's nothing to update in the source nor in the typings but the package is marked as being processed regardless (which is correct).We'll probably need some way of customizing TypeScript's module resolution system here, such that it prefers '.js' files over '.d.ts'.
cc @m-henderson
sarunint commentedon Apr 21, 2019
Relatable: angular/angularfire#2021
JoostK commentedon Apr 21, 2019
@sarunint Thanks for your investigation, it is spot on! If I knew that before it would have saved me a lot of time :) I am actually trying to come up with customized module resolution logic in ngcc to support this.
sarunint commentedon Apr 21, 2019
Well, I spent hours on why ES5 bundle won't compile. Lol
JoostK commentedon Apr 21, 2019
Me too 🤡
sarunint commentedon Apr 21, 2019
Now that the root cause is known, are we going to fix
ivy-ngcc, or fix AngularFire?sarunint commentedon Apr 21, 2019
By "fixing AngularFire", I mean "make amendments to Angular Package Format to specify that the bundles (ESM/FESM 5/2015) must be in a subfolder, then make changes to AngularFire".
6 remaining items
fix(ivy): ngcc - prefer JavaScript source files when resolving module…
StephenFluin commentedon May 13, 2019
@alxhub says we don't correctly compile this under ES5.
fix(ivy): ngcc - prefer JavaScript source files when resolving module…
vdjurdjevic commentedon May 30, 2019
Any progress on this? It works with ng serve and ivy enabled, but with build --prod it fails
JoostK commentedon Jun 1, 2019
@vladimirdjurdjevic Should be fixed once #30591 is in.
kara commentedon Aug 20, 2019
#30591 is in
angular-automatic-lock-bot commentedon Sep 20, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.