File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
417
417
} ,
418
418
419
419
async writeBundle ( ) {
420
- if ( ! program || bundled ) return
420
+ if ( ! host || ! program || bundled ) return
421
421
422
422
bundled = true
423
423
bundleDebug ( 'begin writeBundle' )
@@ -480,6 +480,8 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
480
480
481
481
bundleDebug ( 'emit output patch' )
482
482
483
+ const currentDir = host . getCurrentDirectory ( )
484
+
483
485
await runParallel (
484
486
cpus ( ) . length ,
485
487
Array . from ( outputFiles . entries ( ) ) ,
@@ -504,7 +506,12 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
504
506
const sourceMap : { sources : string [ ] } = JSON . parse ( content )
505
507
506
508
sourceMap . sources = sourceMap . sources . map ( source => {
507
- return normalizePath ( relative ( dirname ( path ) , resolve ( baseDir , source ) ) )
509
+ return normalizePath (
510
+ relative (
511
+ dirname ( path ) ,
512
+ resolve ( currentDir , relative ( publicRoot , baseDir ) , source )
513
+ )
514
+ )
508
515
} )
509
516
content = JSON . stringify ( sourceMap )
510
517
} catch ( e ) {
You can’t perform that action at this time.
0 commit comments