Saw a previous unresolved question here: Absolute module path resolution in TypeScript files in Visual Studio Code.
I am having the same problem with "typescript": "^4.5.5". My tsconfig.json file looks like this:
{
"compilerOptions": {
"outDir": "./built/", // path to output directory
"sourceMap": true, // allow sourcemap support
"strictNullChecks": true, // enable strict null checks as a best practice
"module": "es6", // specify module code generation
"jsx": "react", // use typescript to transpile jsx to js
"target": "es5", // specify ECMAScript target version
"allowJs": true // allow a partial TypeScript and JavaScript codebase
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strict": true,
"plugins": [{ "name": "typescript-plugin-css-modules" }],
"baseUrl": "./src/",
},
"include": ["src"]
}
as Create React App has suggested. However, I still get the error Cannot find module 'xxx' or its corresponding type declarations, where xxx is some module path relative to src.
Would anyone else know how to resolve this?