В моем приложении React я пытаюсь добавить абсолютный путь к SRC, чтобы предотвратить все ../ ..
У меня есть следующий tsconfig:
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"noImplicitAny": false,
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"baseUrl": "src"
},
"include": [
"src"
]
}
Inкомпонент, который я делаю следующим образом:
import { RootState } from 'app/services/store/rootReducer';
import { UsersActions } from 'app/services/store';
Компилируется и работает, но Эслинт говорит, что он не находит модуль.
Cannot find module 'app/services/store/rootReducer'
Я пыталсячтобы добавить это в eslintrc.json
"plugins": [
"react"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"]
},
"es6": {
"paths": ["src"]
}
}
}
}```
But nothing changes.
How can I make absolute path work correctly ?