@use 即将推出,但此版本的 Dart Sass 不支持

问题描述:

我正在使用包含 Sass 的 Angular cli 项目运行 ng serve.我一直在使用 @import@include 没有问题,当我添加 @use 时,终端抛出:

I am running ng serve with an Angular cli project which includes Sass. I have been using @import and @include with no problem, when I added @use, the terminal throws:

@use 即将推出,但此版本的 Dart 不支持萨斯.

@use is coming soon, but it's not supported in this version of Dart Sass.

我的 package.json 使用 "sass": "1.25.0",根据官方文档,@use 从 1.23 开始支持.

My package.json uses "sass": "1.25.0", which according to the official documentation, @use has been supported since 1.23.

有什么我遗漏的吗?

更新:我看到 Angular 将 Sass 列为 package-lock.json 中的依赖项,但版本较旧.我怎样才能使它与 package.json 版本相匹配?我尝试手动更改,run npm i --save 但随后 package-lock.json 恢复到旧版本.

UPDATE: I see that Angular lists Sass as a dependency in package-lock.json but with an older version. How can I make it to match the package.json version? I tried changed manually, run npm i --save but then package-lock.json reverts to the older version.

更新 2 - 2020 年 2 月:即使 package-lock.json 和 package.json 都显示使用 1.25.0 版本的 Sass,仍然无法使用 @use

UPDATE 2 - Feb 2020: Even both package-lock.json and package.json show that use a 1.25.0 version of Sass, still can't use @use

如果你想使用@use,那么去 package.json 并更新 dart-sass

if you want to use @use, then go to package.json and update dart-sass

dart-sass":^1.25.0"