While setting up my project with CRA + Typescript, I configured the paths
property in the tsconfig
file to use absolute paths.
Everything seemed to work fine after my configuration. However, when starting my App using npm run start
or running tests, I noticed that the paths
property was automatically removed.
Below is a snippet from my tsconfig.json
file:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"baseUrl": ".",
"paths": {
"src/*": ["./src/*"]
}
},
"include": [
"src"
]
}
I attempted to utilize the following approach in the test file:
import i18n from 'src/i18n/mocks';
Am I making a mistake in my configuration? Any assistance would be greatly appreciated. Thank you.