在我的反应项目中使用时:
//package.json
"name": "app"
那么智能感知不适用于绝对路径导入
//SomeComponent.js
import {StorageKeys} from 'app/Constants' // inellisense dont work
import {StorageKeys} from '../../Constants' // intellisense works
尝试了一些关于“jsconfig.json”和设置编译器的基本 url 的建议,但没有成功。 有什么想法吗?
答案 0 :(得分:0)
好的,再次进行 RTFM 和 RTFM。
{
"compilerOptions": {
"target": "ES6",
"baseUrl": "./",
"paths" : {
"app/*" : ["./*"]
}
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}