FESM5 error: 'defineInjectable' not found in @angular/core
See original GitHub issueType of Issue
[x] Bug Report…?
[ ] Feature Request
Description
After building an Angular 6.0.0-rc.0 Library and importing into an Angular 5.2.0 app, I get this error:
WARNING in ./node_modules/my_library_name/fesm5/my_library_name.js
19:66-82 "export 'defineInjectable' was not found in '@angular/core'
webpack: Compiled with warnings.
How To Reproduce
Attempt to use an ng6 Library in an ng5 app.
Expected Behaviour
Successfully using an ng5 library in an ng6 app.
Version Information
ng-packagr: 4.1.0
@angular/*: 5.2.0
typescript: 2.6.0
rxjs: 6.2.0
node: 8.9.4
npm/yarn: 5.6.0
Are ng6 packages/libraries backwards-compatible? Any help/expertise would be greatly appreciated! Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
export 'ɵɵinject' was not found in '@angular/core'
I did this but now get: Error: StaticInjectorError(AppModule)[ScullyLibModule -> IdleMonitorService]: StaticInjectorError(Platform: core)[ ...
Read more >defineInjectable - Angular
This API should be used only by generated code, and that code should now use ɵɵdefineInjectable instead. const defineInjectable: <T>( ...
Read more >Angular CLI: "Module not found: Error: Can't resolve..."
In this article, I will walk you through how to fix a an error that many people are encountering with Angular CLI 6+....
Read more >export 'ɵɵdefineInjectable' was not found in '@angular/core'
Removing the character ^ from "ngx-mqtt": "^6.6.0" resolved the problem. ... WARNING in ./node_modules/@agm/core/fesm5/agm-core.
Read more >UNPKG - @angular/core
The CDN for @angular/core. ... @angular/core/fesm5/core.js.map ... {\n return key;\n }\n }\n throw Error('Could not find renamed property on target object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks. It looks like you’re using the
providedIn
feature of@Injectable
, which is new in NG 6 and hence not backwards compatible with NG 5.If you want your library to work in 5, you must not rely on any of the features that are only available since 6, as that won’t work of course.
For Angular 7 or greater version use npm install ng2-charts@2.2.3 --save npm install chart.js --save