我正在维护一个存储库的分支,在我上次更新时我应用了一些更改,但是现在typescript不能识别绝对路径。
我没有对tsconfig.json
进行任何更改:
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"baseUrl": "src",
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"target": "es5",
"types": ["jest", "node"],
"useUnknownInCatchVariables": false
},
"exclude": ["node_modules", "cypress"],
"include": ["src/**/*"]
}
但是现在编译器无法识别如下所示的路径:
import { useIsDarkMode } from 'state/user/hooks'
1条答案
按热度按时间sczxawaw1#
在我删除node_modules并调用
然后一切又开始运转了