-
安装vscode插件
Path Intellisense
-
新增vscode中setting.json配置
"path-intellisense.mappings": {
"@": "${workspaceRoot}/src"
}
3.在src根目录下新建配置文件jsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": [
"node_modules"
]
}
-
重启项目 一定项目一定根目录在vscode中打开