I've been encountering a module not found error while trying to work with jasmine-ts
. To troubleshoot, I decided to use tsc
and inspect my folder structure:
\src\app\...
\src\tests\...
To address this issue, I created a tsconfig.json
at the 'tests' level as shown below:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "../",
"paths": {
"@app/*": [
"app/*"
]
}
}
}
Even after importing a module from the app directory in my '*.test.ts' file, I still receive a module not found error:
Cannot find module '@app/core/data/my-module'
I attempted to run the following command:
tsc --traceResolution test1.test.ts
which produced the following output:
test1.test.ts:2:23 - error TS2307: Cannot find module '@app/core/data/my-module'.
2 import { Field } from '@app/core/data/my-module'
~~~~~~~~~~~~~~~~~~~~~~~~~~