Skip to content

Commit 55914b5

Browse files
authored
fix: lose components types of components.d.ts (#447)
1 parent 1fd5298 commit 55914b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/unplugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { existsSync } from 'fs'
12
import { createUnplugin } from 'unplugin'
23
import { createFilter } from '@rollup/pluginutils'
34
import chokidar from 'chokidar'
@@ -56,9 +57,10 @@ export default createUnplugin<Options>((options = {}) => {
5657
if (config.plugins.find(i => i.name === 'vite-plugin-vue2'))
5758
ctx.setTransformer('vue2')
5859

59-
if (options.dts) {
60+
if (ctx.options.dts) {
6061
ctx.searchGlob()
61-
ctx.generateDeclaration()
62+
if (!existsSync(ctx.options.dts))
63+
ctx.generateDeclaration()
6264
}
6365

6466
if (config.build.watch && config.command === 'build')

0 commit comments

Comments
 (0)