sass版本太高导致 TypeError: this.getOptions is not a function  at Object.loader

1.将原来的sass删除,核心原因是新版本的对getOptions中的方法不兼容:

  

var _getSassOptions = _interopRequireDefault(require("./getSassOptions"));//
 
function loader(content) {
  const options = (0, _loaderUtils.getOptions)(this) || {};//安装高版本的sass,这个位置调用this为default/null,所以报错
  const callback = this.async();

  const addNormalizedDependency = file => {
    // node-sass returns POSIX paths
    this.dependency(_path.default.normalize(file));
  };
 
打开终端,输入:`npm uninstall --save sass-loader`
 

2.安装低版本的sass:

打开终端,输入:npm install -D sass-loader@7.x

相关文章:

  • 2022-12-23
  • 2021-06-18
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-27
  • 2021-11-21
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
相关资源
相似解决方案