From 1a3d18dc287cf2de297082797a48659d05a48f49 Mon Sep 17 00:00:00 2001 From: small Date: Tue, 11 Jan 2022 17:26:40 +0800 Subject: [PATCH 1/2] fix:dts should have default value --- src/core/options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/options.ts b/src/core/options.ts index 120c2702..85ed25a7 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -53,7 +53,7 @@ export function resolveOptions(options: Options, root: string): ResolvedOptions throw new Error('[unplugin-vue-components] `extensions` option is required to search for components') } - resolved.dts = !options.dts + resolved.dts = !resolved.dts ? false : resolve( root, From 9c8161845fd2bf0d4d6cf1ecd03cc2386aa4a86d Mon Sep 17 00:00:00 2001 From: small Date: Wed, 12 Jan 2022 16:35:21 +0800 Subject: [PATCH 2/2] fix:sourcemap must be true --- src/core/options.ts | 4 ++-- src/core/unplugin.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/options.ts b/src/core/options.ts index 85ed25a7..21cb9701 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -57,8 +57,8 @@ export function resolveOptions(options: Options, root: string): ResolvedOptions ? false : resolve( root, - typeof options.dts === 'string' - ? options.dts + typeof resolved.dts === 'string' + ? resolved.dts : 'components.d.ts', ) resolved.root = root diff --git a/src/core/unplugin.ts b/src/core/unplugin.ts index 32365858..c4972ada 100644 --- a/src/core/unplugin.ts +++ b/src/core/unplugin.ts @@ -36,7 +36,7 @@ export default createUnplugin((options = {}) => { vite: { configResolved(config) { ctx.setRoot(config.root) - ctx.sourcemap = config.build.sourcemap + ctx.sourcemap = true if (config.plugins.find(i => i.name === 'vite-plugin-vue2')) ctx.setTransformer('vue2')