File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
105
105
let host : ts . CompilerHost | undefined
106
106
let program : ts . Program | undefined
107
107
let filter : ReturnType < typeof createFilter >
108
+ let rootNames : string [ ] = [ ]
108
109
let rebuildProgram : ( ) => ts . Program
109
110
110
111
let bundled = false
@@ -318,7 +319,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
318
319
319
320
filter = createFilter ( include , exclude )
320
321
321
- const rootNames = [
322
+ rootNames = [
322
323
...new Set (
323
324
Object . values ( entries )
324
325
. map ( entry => ensureAbsolute ( entry , root ) )
@@ -376,10 +377,10 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
376
377
await unwrapPromise ( afterDiagnostic ( diagnostics ) )
377
378
}
378
379
379
- rootNames . forEach ( file => {
380
+ for ( const file of rootNames ) {
380
381
this . addWatchFile ( file )
381
382
rootFiles . add ( file )
382
- } )
383
+ }
383
384
384
385
bundleDebug ( 'create ts program' )
385
386
timeRecord += Date . now ( ) - startTime
@@ -464,7 +465,11 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
464
465
const sourceFile = host . getSourceFile ( id , ts . ScriptTarget . ESNext )
465
466
466
467
if ( sourceFile ) {
467
- rootFiles . add ( sourceFile . fileName )
468
+ for ( const file of rootNames ) {
469
+ rootFiles . add ( file )
470
+ }
471
+
472
+ rootFiles . add ( normalizePath ( sourceFile . fileName ) )
468
473
469
474
bundled = false
470
475
timeRecord = 0
You can’t perform that action at this time.
0 commit comments