5

paths definition in tsconfig.json file.

"baseUrl": ".",
  "paths": {
    "@assets*": ["src/assets*"],
    "@components*": ["src/components*"],
    "@pages*": ["src/pages*"],
    "@theme*": ["src/theme*"],
    "@methods*": ["src/methods*"],
    "@interfaces*": ["src/interfaces*"],
    "@mock_data*": ["src/mock_data*"]
},

Error: Can't resolve '@components/MainTabs/MainTabs'

I think ionic 6 uses vite, so I don't know where to add the config

AbdulAzeez Olanrewaju
  • 976
  • 1
  • 13
  • 32

1 Answers1

0

The regex for the file/directory won't match nested files till you put / for separating directories.

  "@components/*": ["src/components/*"]

Imagine you want to use @component/a/b/c.txs then you can think of * as an alias for a/b/c.ts and then forward that alias in a different directory path (here) src/compoments/a/b/c.ts

amirhe
  • 2,186
  • 1
  • 13
  • 27
Alex Ryltsov
  • 2,385
  • 17
  • 25