From 55914b5545ecad33398f92a860e3f34f72ddc9fa Mon Sep 17 00:00:00 2001 From: Lucas Yang Date: Wed, 6 Jul 2022 11:57:47 +0800 Subject: [PATCH] fix: lose components types of components.d.ts (#447) --- src/core/unplugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/unplugin.ts b/src/core/unplugin.ts index 922e9449..9ca3e8f9 100644 --- a/src/core/unplugin.ts +++ b/src/core/unplugin.ts @@ -1,3 +1,4 @@ +import { existsSync } from 'fs' import { createUnplugin } from 'unplugin' import { createFilter } from '@rollup/pluginutils' import chokidar from 'chokidar' @@ -56,9 +57,10 @@ export default createUnplugin((options = {}) => { if (config.plugins.find(i => i.name === 'vite-plugin-vue2')) ctx.setTransformer('vue2') - if (options.dts) { + if (ctx.options.dts) { ctx.searchGlob() - ctx.generateDeclaration() + if (!existsSync(ctx.options.dts)) + ctx.generateDeclaration() } if (config.build.watch && config.command === 'build')