node-sass升级为dart-sass

卸载node-sass

npm uninstall node-sass

安装dart-sass

npm install sass sass-loader -D

在选择dart-sass版本的时候建议低一些,我一开始比较高"sass": "^1.32.13",,导致我报错,因为我的除法使用的是/写法$num / 200,这样就会报错。

Recommendation: math.div($num, 200)

More info and automated migrator: https://sass-lang.com/d/slash-div

在https://www.npmjs.com/搜dart-sass版本,挨个去试,终于试到"sass": "^1.32.13",这个版本就不报错了。

项目用到/deep/要替换

原来css使用的是/deep/ strong {编译会报错,需要改成::v-deep才行。

修改webpack配置

{
loader: 'sass-loader',
options: {
implementation: require('sass'),
},
},

posted @ 2022-12-02 16:03  翘中之楚  阅读(538)  评论(0编辑  收藏  举报