【发布时间】:2017-12-11 10:17:28
【问题描述】:
我正在尝试将一些变量导入 .vue 组件,但它不起作用,我怀疑 webpack 的配置不正确...
.vue
<style scoped lang="scss">
@import "variables";
...
config.js
...
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'sass-loader': {
data: '@import "variables";',
includePaths: [
// yes, I've tested different paths with no luck...
'/src/scss',
'./src/scss',
path.resolve(__dirname, '/src/scss'),
path.resolve(__dirname, './src/scss')
]
},
},
}
},
...
我看到很多其他人有这种需求,想知道你是否找到了解决方案。将 sass 放入模板很好,但没有变量是没有用的......(当然,我可以只放绝对路径,它可以工作,但这是一个不好的做法......)
【问题讨论】:
标签: webpack sass-loader vue-loader