I'm currently working on an Ionic 7 Vue project in Typescript. One of the challenges I'm facing is creating an alias for shared interfaces using paths in the tsconfig.json file, but the added path doesn't seem to resolve. Below is a snippet of my tsconfig.json setup:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"types": ["webpack-env", "jest", "google.maps", "cypress"],
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],// <-------------------------------- This alias resolves fine.
"@shared/*": ["../server/src/*/shared/index.ts"] // <- This one doesn't.
// "@shared/*": ["../server/src/*/shared"] // <------- This also doesn't work (same error).
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
// mp035 added
"strictPropertyInitialization": false
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx",
"../server/src/**/shared/*.ts" // <----------------- these files are found fine.
],
"exclude": ["node_modules"]
}
During the build process, I encounter the following error:
Module not found: Error: Can't resolve '@shared/bookings' in '/XXXXXX/XXXXX/app/src/views/customer'
I would appreciate any insights or suggestions on what might be causing this issue.