This module allows you to rollback to relative paths in tsconfig. See nuxt/nuxt#21827 for more information.
Module only works in development mode.
As #components
are inserted AFTER custom module hooks I wasn't able to modify this entry. The reason behind this is
that for example in prepare hook "prepare:types" is the last hook. #components are being added AFTER "last hook",
therefore without tricky solutions I will not be able to replace #components path.
If you need types, as workaround you can use ##components
alias for now. But I highly recommend to stay
on #components
and wait for my fix or Nuxt team official fix (this is preferred of course).
- Add
nuxt-tsconfig-relative-paths
dependency to your project
# Using pnpm
pnpm add -D nuxt-tsconfig-relative-paths
# Using yarn
yarn add --dev nuxt-tsconfig-relative-paths
# Using npm
npm install --save-dev nuxt-tsconfig-relative-paths
- Add
nuxt-tsconfig-relative-paths
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'other-modules',
'nuxt-tsconfig-relative-paths'
]
})