8000 fix(nuxt): use relative paths when augmenting types (#22633) · nuxt/nuxt@bb83ab5 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb83ab5

Browse files
authored
fix(nuxt): use relative paths when augmenting types (#22633)
1 parent a16edba commit bb83ab5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/nuxt/src/pages/module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { addBuildPlugin, addComponent, addPlugin, addTemplate, addVitePlugin, ad
44
import { dirname, join, relative, resolve } from 'pathe'
55
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
66
import { joinURL } from 'ufo'
7-
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
7+
import type { Nuxt, NuxtApp, NuxtPage } from 'nuxt/schema'
88
import { createRoutesContext } from 'unplugin-vue-router'
99
import { resolveOptions } from 'unplugin-vue-router/options'
1010
import type { EditableTreeNode, Options as TypedRouterOptions } from 'unplugin-vue-router'
@@ -339,8 +339,8 @@ export default defineNuxtModule({
339339

340340
addTemplate({
341341
filename: 'types/middleware.d.ts',
342-
getContents: ({ app }: { app: NuxtApp }) => {
343-
const composablesFile = resolve(runtimeDir, 'composables')
342+
getContents: ({ nuxt, app }: { nuxt: Nuxt, app: NuxtApp }) => {
343+
const composablesFile = relative(join(nuxt.options.buildDir, 'types'), resolve(runtimeDir, 'composables'))
344344
const namedMiddleware = app.middleware.filter(mw => !mw.global)
345345
return [
346346
'import type { NavigationGuard } from \'vue-router\'',
@@ -356,8 +356,8 @@ export default defineNuxtModule({
356356

357357
addTemplate({
358358
filename: 'types/layouts.d.ts',
359-
getContents: ({ app }: { app: NuxtApp }) => {
360-
const composablesFile = resolve(runtimeDir, 'composables')
359+
getContents: ({ nuxt, app }: { nuxt: Nuxt, app: NuxtApp }) => {
360+
const composablesFile = relative(join(nuxt.options.buildDir, 'types'), resolve(runtimeDir, 'composables'))
361361
return [
362362
'import { ComputedRef, MaybeRef } from \'vue\'',
363363
`export type LayoutKey = ${Object.keys(app.layouts).map(name => genString(name)).join(' | ') || 'string'}`,

0 commit comments

Comments
 (0)
0