Skip to content

Commit 669be0b

Browse files
fix: declaration generation not detecting absolute paths on Windows (#167)
1 parent 8720195 commit 669be0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/declaration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve, dirname, relative } from 'path'
1+
import { resolve, dirname, relative, isAbsolute } from 'path'
22
import { promises as fs, existsSync } from 'fs'
33
import { notNullish, slash } from '@antfu/utils'
44
import { Context } from './context'
@@ -19,7 +19,7 @@ export async function generateDeclaration(ctx: Context, root: string, filepath:
1919
if (!name)
2020
return undefined
2121

22-
const related = slash(path).startsWith('/')
22+
const related = isAbsolute(path)
2323
? `./${relative(dirname(filepath), path)}`
2424
: path
2525

0 commit comments

Comments
 (0)