【问题标题】:SassError: There is no module with the namespace "math"SassError:没有名称空间“math”的模块
【发布时间】:2020-08-03 10:13:31
【问题描述】:

我无法让数学 SASS 库在 Vue 应用程序中工作。它使用 Dart Sass 和 sass-loader 编译。 Dart Sass 版本是 1.26.3,所以数学模块应该工作。

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: There is no module with the namespace "math".

@for $i from 2 through 10 
    &:nth-child(#{$i}) { transition-duration: 300ms + $i * 50ms - 400ms * math.floor($i / 8); }
                                                                          ^^^^^^^^^^^^^^^^^^
}

【问题讨论】:

    标签: sass


    【解决方案1】:

    想通了。我需要添加

    @use 'sass:math';
    

    在文件的顶部。

    【讨论】:

    【解决方案2】:

    我可以向您推荐的是一种自动(惰性)方式 - 您可以使用:

    $ npm install -g sass-migrator
    $ sass-migrator division **/*.scss
    

    发件人:https://sass-lang.com/documentation/breaking-changes/slash-div#automatic-migration

    【讨论】:

      猜你喜欢
      • 2021-11-10
      • 2018-09-04
      • 1970-01-01
      • 1970-01-01
      • 2015-09-09
      • 1970-01-01
      • 2020-07-14
      • 2022-01-26
      • 1970-01-01
      相关资源
      最近更新 更多