1 ~
resolve: {
extensions: ['.js', '.vue'],
alias: {
'vue': 'vue/dist/vue.esm.js',
'components': resolve('src/components'),
'common': resolve('src/common'),
'config': resolve('src/config'),
'views': resolve('src/views')
}
}
<style scoped lang="scss">
@import "~common/sass/variables";
@import "~common/sass/mixin";
/* ... */
</style>
~是默认代表当前项目的更目录,需要在alias里面配置个别名
vue在DOM元素里面用别名需要加~