14

我有一个第三方 SCSS 文件包含在我的项目中,结果 Dart SASS 显示一长串警告。如何禁用第三方包含的警告?

我将 Vue 与 Dart SCSS 一起使用。Dart 有一个 quietDeps 选项,但我不确定我是否以正确的方式使用它。

// _common.scss
// Line below causes warnings to be displayed.
@import "~@progress/kendo-theme-default/dist/all";
// ...
// Vue.config.js
module.exports = {
  // ...
  css: {
    loaderOptions: {
      sass: {
        prependData: '@import "~@/styles/common";',
        sassOptions: {
          quietDeps: true
        }
      }
    }
  }
}
4

3 回答 3

8

See the following issues: https://github.com/webpack-contrib/sass-loader/issues/954 and https://github.com/sass/sass/issues/3065.

The quietDeps option isn't exposed yet to the Node.js API.

In the meantime you can downgrade to sass 1.32 without too many changes.

EDIT: It's now available in sass 1.35.1.

于 2021-06-04T11:28:39.207 回答
3

对于 NuxtJS,将其添加到 nuxt.config.js

  build: {
    loaders: {
      scss: {
        sassOptions: {
          quietDeps: true
        }
      }
    }
  }
于 2021-09-22T20:24:18.690 回答
2

对于任何寻找 Encore 配置的人

Encore.enableSassLoader((options) => {
  options.sassOptions = {
    quietDeps: true, // disable warning msg
  }
})
于 2021-08-07T15:12:59.237 回答