[英]Migrating Angular Material to v12 does not remove old import syntax
I upgraded my Angular app to v12, and since I am using Material, I upgraded Material as well.我将我的 Angular 应用程序升级到 v12,因为我使用的是 Material,所以我也升级了 Material。
In the v12 announcement article they said that Material now expose new @use
syntax and upgrade should migrate syntax automatically.在v12 公告文章中,他们说 Material 现在公开了新的
@use
语法,并且升级应该自动迁移语法。 They also added code example of the new VS old syntax .他们还添加了新 VS 旧语法的代码示例。
So basically @import '~@angular/material/theming;
所以基本上
@import '~@angular/material/theming;
should be replaced with @use '~@angular/material' as mat;
应替换为
@use '~@angular/material' as mat;
. .
When I checked changes after upgrade finished successfully, I noticed that in the styles.scss
the @use '~@angular/material' as mat;
当我在升级成功完成后检查更改时,我注意到在
styles.scss
中@use '~@angular/material' as mat;
line were added, BUT @import '~@angular/material/theming;
添加了行,但是
@import '~@angular/material/theming;
line was NOT removed .线没有被删除。 So now, I have both
@use
and import
in my styles.scss
file.所以现在,我的
styles.scss
文件中有@use
和import
。
Should I remove @import '~@angular/material/theming;
我应该删除
@import '~@angular/material/theming;
? ? As I understand, it will import the same thing twice, so it can only increase the size of the file.
据我了解,它会导入相同的东西两次,所以它只能增加文件的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.