Skip to content

Commit

Permalink
fix: should pass full path to resolver.support
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Jul 13, 2023
1 parent 5e5b93c commit 7088a0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {

async transform(code, id) {
let resolver: Resolver | undefined
id = normalizePath(id).split('?')[0]
id = normalizePath(id)

if (
!host ||
Expand All @@ -349,6 +349,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
const outDir = outDirs[0]
const service = program.__vue.languageService as unknown as ts.LanguageService

id = id.split('?')[0]
rootFiles.delete(id)

if (resolver) {
Expand Down Expand Up @@ -392,7 +393,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
},

watchChange(id) {
id = normalizePath(id).split('?')[0]
id = normalizePath(id)

if (
!host ||
Expand All @@ -403,7 +404,8 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
return
}

const sourceFile = host.getSourceFile(normalizePath(id), ts.ScriptTarget.ESNext)
id = id.split('?')[0]
const sourceFile = host.getSourceFile(id, ts.ScriptTarget.ESNext)

if (sourceFile) {
rootFiles.add(sourceFile.fileName)
Expand Down

0 comments on commit 7088a0c

Please sign in to comment.