1👍
✅
Nuxt advises against overriding the path in tsconfig.json in the root of the project
documentation here: https://nuxt.com/docs/guide/directory-structure/tsconfig
note that if you need to customize your paths, this will override the
auto-generated path aliases. Instead, we recommend that you add any
path aliases you need to the alias property within your nuxt.config
You need to add it to nuxt.config.ts
alias: {
"~shared": fileURLToPath(new URL("./shared", import.meta.url)),
},
re-run nuxt server and now in your index.ts you can now import useFoo
import import { useFoo } from '~shared/foo'
Source:stackexchange.com