Currently, I'm in the process of transitioning my Ionic 3 application to Ionic 4 with Typescript 3.1, but I'm facing challenges with the Typescript paths.
Within my tsconfig.json
, I have the following setup:
"paths": {
"@models": [ "src/models/index" ],
"@services": [ "src/services/index" ],
"@shared": [ "src/shared/index" ],
"@app/*": [ "src/app/*" ],
"@models/*": [ "src/models/*" ],
"@services/*": [ "src/services/*" ],
"@shared/*": [ "src/shared/*" ]
},
as well as this configuration in my src/tsconfig.app.json
:
"paths": {
"@models": [ "models/index" ],
"@services": [ "services/index" ],
"@shared": [ "shared/index" ],
"@app/*": [ "app/*" ],
"@models/*": [ "models/*" ],
"@services/*": [ "services/*" ],
"@shared/*": [ "shared/*" ]
},
Despite Visual Studio recognizing the files without any errors, when I attempt to run ionic serve
, it fails to locate these files. Error messages like the following start popping up:
[ng] src/models/jobs/job.model.ts(1,33): error TS2307:
Cannot find module '@models/customers/customer.model'.
This occurs at the line:
import { ICustomerModel } from "@models/customers/customer.model";
Is there a way for me to ensure that ionic serve
respects my Typescript paths?