Skip to content

Commit

Permalink
fix: use relative paths when generating types (#2811)
Browse files Browse the repository at this point in the history
  • Loading branch information
aisteneciunaitevalantic committed Feb 20, 2024
1 parent d41a4a3 commit c43842f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gen.ts
Expand Up @@ -4,7 +4,7 @@ import createDebug from 'debug'
import { EXECUTABLE_EXTENSIONS } from './constants'
import { genImport, genDynamicImport } from 'knitwork'
import { withQuery } from 'ufo'
import { resolve } from 'pathe'
import { resolve, relative, join } from 'pathe'
import { distDir, runtimeDir } from './dirs'
import { getLayerI18n, getLocalePaths, toCode } from './utils'

Expand Down Expand Up @@ -172,8 +172,14 @@ export function generateI18nTypes(nuxt: Nuxt, options: NuxtI18nOptions) {
// prettier-ignore
return `// Generated by @nuxtjs/i18n
import type { ${vueI18nTypes.join(', ')} } from 'vue-i18n'
import type { NuxtI18nRoutingCustomProperties, ComposerCustomProperties } from '${resolve(runtimeDir, 'types.ts')}'
import type { Strategies, Directions, LocaleObject } from '${resolve(distDir, 'types.d.ts')}'
import type { NuxtI18nRoutingCustomProperties, ComposerCustomProperties } from '${relative(
join(nuxt.options.buildDir, 'types'),
resolve(runtimeDir, 'types.ts')
)}'
import type { Strategies, Directions, LocaleObject } from '${relative(
join(nuxt.options.buildDir, 'types'),
resolve(distDir, 'types.d.ts')
)}'
declare module 'vue-i18n' {
interface ComposerCustom extends ComposerCustomProperties<${resolvedLocaleType}> {}
Expand Down

0 comments on commit c43842f

Please sign in to comment.