添加jsconfig.json
{
"compilerOptions": {
"target": "es2015",
"baseUrl": "./src",
"paths": {
"@api/*": ["api/*"],
"@common/*": ["common/*"],
"@components/*": ["components/*"],
"@doc/*": ["../doc/*"],
"@domain/*": ["domain/*"],
"@router/*": ["router/*"],
"@model/*": ["domain/model/*"],
"@service/*": ["domain/service/*"],
"@store/*": ["store/*"],
"@utils/*": ["utils/*"],
"@views/*": ["views/*"],
},
"allowSyntheticDefaultImports": true
},
"exclude": ["node_modules", "dist"]
}
- 注意下*,之前没加没有生效
- exclude 可以加速
paths
配置alias,这样就可以在代码里使用alias
import createRouter from '@/router';
import store from '@/store';