我的问题是 mochapack 似乎无法与样式资源加载器一起使用。
似乎产生问题的软件包:
- "@vue/cli-plugin-unit-mocha": "~4.2.0",
- “vue-cli-plugin-style-resources-loader”:“~0.1.4”
我的vue.config.js
文件:
const path = require("path");
module.exports = {
...
pluginOptions: {
"style-resources-loader": {
preProcessor: "scss",
patterns: [path.resolve(__dirname, "./src/assets/styles/*.scss")]
}
}
};
通过上述配置包含的单个 sass 文件:
@import "~vue-select/src/scss/vue-select.scss";
它似乎vue-select.scss
正确加载,但是在解释此文件时,它似乎丢失了当前目录并且找不到导入的样式。
错误日志摘录:
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
╷
1 │ @import "global/variables";
│ ^^^^^^^^^^^^^^^^^^
╵
/node_modules/vue-select/src/scss/vue-select.scss 1:9 @import
/src/components/HelloWorld.vue 1:9
查看完整的详细错误消息和代码: https ://github.com/petritz/food-calculator-web/runs/560575367