Skip to content

Commit 2c59340

Browse files
committed
fix: slash on windows, close #49
1 parent 3a38b53 commit 2c59340

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/declaration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { resolve, dirname, relative } from 'path'
22
import fs from 'fs/promises'
33
import { Context } from './context'
4+
import { slash } from './utils'
45

56
export async function generateDeclaration(ctx: Context, root: string, filepath: string) {
67
const lines = Object.values(ctx.componentNameMap)
78
.map(({ path, name, importName }) => {
8-
const related = path.startsWith('/')
9+
const related = slash(path).startsWith('/')
910
? `./${relative(dirname(filepath), resolve(root, path.slice(1)))}`
1011
: path
11-
let entry = `${name}: typeof import('${related}')`
12+
let entry = `${name}: typeof import('${slash(related)}')`
1213
if (importName)
1314
entry += `['${importName}']`
1415
else

0 commit comments

Comments
 (0)