@@ -6,7 +6,9 @@ import DtsPlugin from 'rollup-plugin-dts'
6
6
import { fsExists , fsRemove } from '../utils/fs'
7
7
import { typeAsserts } from '../utils/general'
8
8
import type { NormalizedFormat , ResolvedOptions } from '../options'
9
+ import { ExternalPlugin } from './external'
9
10
import type { OutputExtension } from './output'
11
+ import type { PackageJson } from 'pkg-types'
10
12
import type { Options as IsolatedDeclOptions } from 'unplugin-isolated-decl'
11
13
12
14
const TEMP_DTS_DIR = '.tsdown-types'
@@ -21,6 +23,7 @@ export async function bundleDts(
21
23
options : ResolvedOptions ,
22
24
jsExtension : OutputExtension ,
23
25
format : NormalizedFormat ,
26
+ pkg ?: PackageJson ,
24
27
) : Promise < void > {
25
28
typeAsserts < IsolatedDeclOptions > ( options . dts )
26
29
@@ -40,12 +43,14 @@ export async function bundleDts(
40
43
} )
41
44
const build = await rollup ( {
42
45
input : dtsEntry ,
46
+ external : options . external ,
43
47
onLog ( level , log , defaultHandler ) {
44
48
if ( log . code !== 'EMPTY_BUNDLE' && log . code !== 'UNRESOLVED_IMPORT' ) {
45
49
defaultHandler ( level , log )
46
50
}
47
51
} ,
48
52
plugins : [
53
+ ExternalPlugin ( options , pkg ) as any ,
49
54
{
50
55
name : 'resolve-dts' ,
51
56
async resolveId ( id , importer ) {
0 commit comments