我为路径(别名)添加打字稿配置:
tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"baseUrl": "src",
"paths": {
"@components/*": ["components/*"]
}
},
"exclude": [
"node_modules",
"public"
]
}
之后我尝试导入这样的东西:
import Header from '@components/header';
现在我在 eslint 中遇到错误:ESLint: Unable to resolve path to module '@components/header'.(import/no-unresolved)