nuxt.js引入scss文件,变量Undefined variable
在nuxt.config.js中使用styleResources引入公共scss文件,变量报错
error in ./layouts/default.vue?vue&type=style&index=0&id=314f53c6&lang=scss&scoped=true& Module build failed (from ./node_modules/sass-loader/lib/loader.js): undefined ^ Undefined variable: "$white". in e:\Vue\blog-nuxt\layouts\default.vue (line 84, column 17) @ ./node_modules/vue-style-loader??ref--6-oneOf-1-0!./node_modules/css-loader??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-1-3!./node_modules/style-resources-loader/lib??ref--6-oneOf-1-4!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=style&index=0&id=314f53c6&lang=scss&scoped=true& 4:14-462 14:3-18:5 15:22-470 @ ./layouts/default.vue?vue&type=style&index=0&id=314f53c6&lang=scss&scoped=true& @ ./layouts/default.vue @ ./.nuxt/App.js @ ./.nuxt/index.js @ ./.nuxt/client.js @ multi webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=/__webpack_hmr ./.nuxt/client.js
开始是node升级node11.0导致的node-sass或sass-loader版本过低的问题
最后可能nuxt.js升级到2.0后,styleResources引用路径不能使用~。把~换成./后,引用成功,报错解决
相关推荐
前端 2020-08-03
maiktom 2020-05-11
StylusGalaxy 2020-04-29
前端 2020-04-29
骷髅狗 2020-04-24
jiangfulai 2020-04-18
jiangfulai 2020-04-11
jiangfulai 2020-03-05
taoqidejingling 2020-03-05
ZylCN 2020-03-03
前端 2020-02-19
不知道写什么 2020-01-16
xxuncle 2019-12-27
zhanghao 2019-12-27
wghou 2019-12-27
王军强 2019-11-17
ZylCN 2019-11-12
tianzyc 2019-11-08