noxi雑記

.NET、Angularまわりの小ネタブログ

Angular Material 8のためのImport Blacklist

Angular Materialはバージョン8で @angular/material からのインポートを非推奨にしました。またバージョン9からは @angular/material でのエクスポートがされなくなります。

github.com

Importing directly from the root @angular/material entry-point is deprecated. You should instead import from specific entry-points, e.g. @angular/material/button. This aligns with @angular/cdk, makes clear where symbols originate, and helps safeguard against including unused code. The deprecated style will be removed in Angular v9.

tslint.jsonimport-blacklist にこれを追加しておくと、開発時にうっかり @angular/material からインポートすることを防止してくれます。

"import-blacklist": [
  true,
  "rxjs/Rx",
  "@angular/material",  // これ
  "@angular/material/typings/*" // これ
]