While working with SCSS in vue-cli3, I encountered a strange bug where using /deep/ would result in errors that I prefer not to deal with.
Code Running Environment: vue-cli3 + vant + scss
CSS:
/deep/ .van-tabs__content.van-tabs__content--animated,
.van-tabs--line,
.van-pull-refresh,
.van-pull-refresh__track {
height: 100%;
}
vue.config.js:
css: {
loaderOptions: {
sass: {
data: `@import "~@/style/module.scss";`
}
}
},
Error:
Failed to compile with 1 error 14:14:46
error in ./src/views/RankingList.vue?vue&type=style&index=0&lang=scss&
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
.van-tabs--line,
^
Expected selector.
╷
274 │ /deep/ .van-tabs__content.van-tabs__content--animated,
│ ^
╵
stdin 274:3 root stylesheet
in F:\web\project-a\src\views\RankingList.vue (line 274, column 3)
@ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/lib/loader.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/RankingList.vue?vue&type=style&index=0&lang=scss& 4:14-444 14:3-18:5 15:22-452
@ ./src/views/RankingList.vue?vue&type=style&index=0&lang=scss&
@ ./src/views/RankingList.vue
@ ./src/router.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.100.15:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js