From 88469d0e6a8883a18e93e185da8060b66cf60550 Mon Sep 17 00:00:00 2001 From: qmhc <40221744+qmhc@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:35:50 +0800 Subject: [PATCH] fix: correct match result for alias form tsconfig fix #298 --- src/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index 94cc5e9..73809d4 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -288,9 +288,9 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin { if (pathsToAliases && baseUrl && paths) { const basePath = ensureAbsolute(baseUrl, configPath ? dirname(configPath) : root) - for (const [findWithAsterisk, replacements] of Object.entries(paths)) { + for (const [pathWithAsterisk, replacements] of Object.entries(paths)) { const find = new RegExp( - findWithAsterisk.replace(regexpSymbolRE, '\\$1').replace(asteriskRE, '(.+)') + `^${pathWithAsterisk.replace(regexpSymbolRE, '\\$1').replace(asteriskRE, '(.+)')}$` ) let index = 1