From 8d529041ae297dd4d3496df078c84ebeaeed9be5 Mon Sep 17 00:00:00 2001 From: Shigma Date: Sun, 11 Feb 2024 18:39:19 +0800 Subject: [PATCH] feat: copy .d.ts files --- src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 63186a7..92d995f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -76,6 +76,7 @@ const externalPlugin = (meta: PackageJson, exports: Record meta[type]?.[name])) if (types.size === 0) throw new Error(`Missing dependency: ${name}`) // devDependencies are bundled @@ -84,14 +85,12 @@ const externalPlugin = (meta: PackageJson, exports: Record { - console.log('before:', args.path) const { path } = await build.resolve(args.path, { namespace: 'internal', importer: args.importer, resolveDir: args.resolveDir, kind: args.kind, }) - console.log('after:', path) if (currentEntry === path || !exports[path]) return null if (format === 'cjs') return { external: true } // native ESM import should preserve extensions @@ -102,6 +101,11 @@ const externalPlugin = (meta: PackageJson, exports: Record { + const contents = await fs.readFile(args.path) + return { loader: 'copy', contents } + }) }, })