Skip to content

Commit

Permalink
fix: use relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Jan 21, 2025
1 parent 567d26a commit 2ec56b6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Loader, PluginBuilder } from 'bun'
import type { AutoImportsOptions, AutoImportsPlugin, ESLintOptions } from './types'
import { Glob } from 'bun'
import path from 'node:path'
import { generateESLintGlobals } from './eslint'

function getLoader(path: string): string {
Expand Down Expand Up @@ -89,11 +90,17 @@ export function autoImports(options: Partial<AutoImportsOptions>): AutoImportsPl
})),
)

const dtsPath = path.resolve(options.dts ?? './auto-imports.d.ts')
const dtsDir = path.dirname(dtsPath)

const unimport = createUnimport({
...options,
imports: [
...(options.imports || []),
...scannedImports,
...scannedImports.map(imp => ({
...imp,
from: `./${path.relative(dtsDir, imp.from).replace(/\\/g, '/')}`,
})),
],
dts: undefined,
} as AutoImportsOptions)
Expand Down

0 comments on commit 2ec56b6

Please sign in to comment.