@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"
,根据官方文档,从1.23开始支持 @use
.
My package.json uses "sass": "1.25.0"
, which according to the official documentation, @use
has been supported since 1.23.
有什么我想念的吗?
更新:我看到Angular在package-lock.json中将Sass列为依赖项,但是版本较旧.如何使其与package.json版本匹配?我尝试手动更改,运行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
这是因为build-angular中的依赖项仍然引用旧的sass.
It's because the dependency in build-angular still refer to the old sass.
这就是我所做的.更新sass之后,转到build-angular的package.json中的node_modules/@ angular-devkit/build-angular更新依赖项.如果build-angular/node_modules中有旧版本的sass,则也需要删除它.
Here is what I did. After update sass, go node_modules/@angular-devkit/build-angular update dependency in build-angular's package.json. If there is an old version of sass in build-angular/node_modules, you need to remove that too.
希望这会有所帮助.