The issue is caused by package @angular/core
Yes, the previous version in which this bug was not present was: 8.0.0-beta.11
I'm the author of @ngx-pwa/local-storage
, one of the main Angular library for local storage management, and I'm preparing for Angular V8 from some weeks.
I'd like v8 version of the lib to work in Angular 8 and in Angular 7 too if possible (due to some issues that happened in v7 like cyrilletuzi/angular-async-local-storage#64).
It worked well until Angular v8.0.0-beta.11, but since Angular v8.0.0-beta.12, using the lib in an Angular 7 project results in these messages on build:
WARNING in ./node_modules/@ngx-pwa/local-storage/fesm5/ngx-pwa-local-storage.js 256:36-54
"export 'ɵɵdefineInjectable' was not found in '@angular/core'
...
WARNING in ./node_modules/@ngx-pwa/local-storage/fesm5/ngx-pwa-local-storage.js 865:168-176
"export 'ɵɵinject' was not found in '@angular/core'
In the browser's console, the same errors appear and the app is completely broken due to this error:
Uncaught TypeError: Object(...) is not a function
git clone https://github.com/cyrilletuzi/ng8injectissue.git
cd ng8injectissue
npm start
It's just an empty Angular 7 project generated with ng new
, then npm install
the lib and just inject the service of the lib inside AppComponent
constructor.
The lib is generated with all official tools (last Angular CLI and ng-packagr), you can see the v8 code here.
Anything else relevant? Note that Angular v8.0.0-beta.12 was the version where Angular bumped from TypeScript 3.3 to 3.4.
So is this the desired behavior (ie. breaking retro-compatibility with v7?) or not? I thought imports starting with ɵɵ
were Angular internals, so that they end up in the lib code seem more like a bug.
Lib issue: cyrilletuzi/angular-async-local-storage#103
I just encountered a similar issue after running ng build
with Angular 7 (migrated from Angular 5), precisely:
ERROR in ./node_modules/@angular/platform-browser/fesm5/platform-browser.js 2017:15-24
"export 'ɵAPP_ROOT' was not found in '@angular/core'
I did following steps and things are working fine for me.
npm install -S @angular/material @angular/cdk @angular/animations
npm uninstall @angular/core
npm install -S @angular/core
Thank you guys!!
Fixed that issue as well