-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WARNING: '__read' is imported from external module 'tslib' but never used #1543
Comments
I'm facing the exact same issue. It would be great if someone can get along and find the root cause or the place where the library is imported incorrectly. My application works great though! |
I was getting the same error. To find where it was coming from, I searched the
|
It make sense as I’m using too. But I was using on the previous version and
didn’t get that error.
On Sun, 23 Feb 2020 at 7:35 am, Kishan Gajera ***@***.***> wrote:
I was getting the same error. To find where it was coming from, I searched
the dist directory for __read. I found that it was being included because
my module was using the spread operator:
@NgModule({
declarations: [
...COMPONENTS
],
)}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1543?email_source=notifications&email_token=AC4AGT4OSE6CMU3KWVX7U73REGLDZA5CNFSM4KUSS2XKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVLDZI#issuecomment-590000613>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC4AGT6Z4YTCV3CO6CIQQM3REGLDZANCNFSM4KUSS2XA>
.
--
Sent from iPhone
|
Something which is probably related to this problem 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: import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
@Component({
selector: 'lib-my-lib',
template: `
<p>
my-lib works!
</p>
`,
styles: [],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MyLibComponent implements OnInit, OnDestroy {
constructor(
private cd: ChangeDetectorRef
) { }
ngOnInit(): void {
this.cd.markForCheck();
}
ngOnDestroy(): void {
}
} this compiles with warning import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef } from '@angular/core'; 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: angular/angular#21280 |
Same here |
Some news here? |
Thanks for @multimike77 's answer, but is there anyone who know why such the change will take effect? |
Hey @multimike77, Classes have a value at runtime and a type at design-time, and the use is context-sensitive. You can't mix them in one import line. |
Hello, The |
In my case tree dots(...) inside one of my component cause the same error.
when ever i remove these tree dots the warning goes away. any improvements? |
For import splitting see ng-packagr/ng-packagr#1543 (comment)
…" Angular warning. See ng-packagr/ng-packagr/issues/1543 for more info.
… from external module '@angular/core' but never used" Angular warning by separating type definition imports. See ng-packagr/ng-packagr/issues/1543#issuecomment-593873874 for more info.
I have same warning in angular library any news on this. Is this something to be worried about |
I wasn't able to reproduce the issue. The spread operator inside the NgModule declarations property doesn't cause any issues. @Dzivo, can you please provide a minimal repository where this issue is present? NOTE: In this issue people talk about two different warnings with a similar message:
|
I am unable to reproduce. Please file a new issue with a reproduction if the problem persists. |
This issue has been automatically locked due to inactivity. |
Type of Issue
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
Please include all version numbers that might be relevant, e.g. third-party libraries
The text was updated successfully, but these errors were encountered: