WARNING: '__read' is imported from external module 'tslib' but never used
See original GitHub issueType of Issue
[ X] Bug Report
[ ] Feature Request
Description
Trying to build the package and getting the following error warning
WARNING: ‘__read’ is imported from external module ‘tslib’ but never used
Not usre where it’s been exported, but it’s not from my project.
Note, I’ve just update from Angular 8 to 9.0.1
How To Reproduce
ng build
Expected Behaviour
Success with no warning
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: x.y.z
@angular/*: x.y.z
typescript: x.y.z
rxjs: x.y.z
node: x.y.z
npm/yarn: x.y.z
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 4 years ago
- Reactions:24
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Module never used warning while building Angular 9 library
I tried to find the root cause of it but I couldn't. There is one github issue related to this but there was...
Read more >@rollup/plugin-typescript - npm
Start using @rollup/plugin-typescript in your project by running ... Create a rollup.config.js configuration file and import the plugin:.
Read more >TSConfig Reference - Docs on every TSConfig option
A module file is a file that has imports and/or exports. Without this flag, using an export from a UMD module requires an...
Read more >Introduction - rollup.js
Introduction. Overview. Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, ...
Read more >Understanding TypeScript Configuration Options
By using it, you can structure your TypeScript project into smaller pieces. ... This syntax requires an imported helper but module 'tslib' cannot...
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
Something which is probably related to this problem as well. On my library project I was getting many errors like
WARNING: 'OnInit', 'OnDestroy', 'AfterContentInit' are imported from external module '@angular/core' but never used
apart from having the__read is imported...
erorr as described above as well.After experimenting a bit, I found out something interesting. I could manage to make the warning about OnInit, OnDestroy, etc. disappear by separating the import statements in two:
For example:
this compiles with warning
WARNING: 'OnDestroy' and 'OnInit' are imported from external module '@angular/core' but never used.
But when changing the imports to be like
compilation works fine without any warnings.
So somehow the compiler is no able to optimize/rewrite the import statements so that only relevant imports are kept.
Probably related to: https://github.com/angular/angular/issues/21280
Some news here?