sass-loader 版本问题导致编译报错记录

使用vue-cli 创建 uni-app项目,需要使用sass,安装上相关依赖包后,运行报错:

Style Loader has been initialized using an options object that does not match the API schema.  
options has an unknown property 'prependData'.

使用 vue inspect 命令查看到css loader options中有prependData的配置项,去sass-loader github上查阅更新记录发现9.0.0的版本升级中去掉了prependData,升级成了additionalData选项。

引用原文:

9.0.0 (2020-07-02)

⚠ BREAKING CHANGES

  • minimum supported Nodejs version is 10.13
  • prefer sass (dart-sass) by default, it is strongly recommended to migrate on sass (dart-sass)
  • the prependData option was removed in favor the additionalData option, see docs
  • when the sourceMap is true, sassOptions.sourceMap, sassOptions.sourceMapContents, sassOptions.sourceMapEmbed, sassOptions.sourceMapRoot and sassOptions.omitSourceMapUrl will be ignored.

你可能感兴趣的:(sass)