fe-interview
fe-interview copied to clipboard
webpack添加路径别名后,vscode不能智能提示,如何解决?
webpack添加路径别名后,vscode不能智能提示,如何解决?
添加jsconfig.json文件
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@app/*": ["app/*"],
"@components/*": ["app/build/components/*"],
"@common/*": ["app/build/common/*"],
"@actions/*": ["app/build/actions/*"],
"@enums/*": ["app/enums/*"],
"@styles/*": ["app/build/style/*"]
},
"target": "ES6",
"module": "commonjs",
"jsx": "react", // 重要!支持jsx文件,否则jsx文件无法跳转
"allowSyntheticDefaultImports": true
},
"include": [
"app/**/*"
],
"exclude": ["node_modules"]
}
注:
path 与 webpack配置的路径别名对应
jsx 支持jsx文件