webstorm 识别vue项目中的@路径别名正确解析的配置方法
2020-06-08 本文已影响0人
如果俞天阳会飞
根目录下新建webstorm.config.js,写入
'use strict'
const path = require('path')
function resolve (dir) {
return path.join(__dirname, '.', dir)
}
module.exports = {
context: path.resolve(__dirname, './'),
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src'),
'_c': resolve('src/components')
}
}
}
然后导入到webstorm下即可,如下图
image.png