diff --git a/packages/unplugin-typia/src/core/index.ts b/packages/unplugin-typia/src/core/index.ts index 19b778cb..e8174eb5 100644 --- a/packages/unplugin-typia/src/core/index.ts +++ b/packages/unplugin-typia/src/core/index.ts @@ -2,6 +2,7 @@ import type { UnpluginFactory, UnpluginInstance } from 'unplugin'; import { createUnplugin } from 'unplugin'; import { createFilter as rollupCreateFilter } from '@rollup/pluginutils'; import MagicString from 'magic-string'; +import { resolve } from 'pathe'; import type { ResolvedOptions } from './options.ts'; import type { Options } from './options.js'; @@ -123,7 +124,7 @@ const unpluginFactory: UnpluginFactory< async transform(_source, _id) { const source = wrap(_source); - const id = wrap(_id); + const id = wrap(resolve(_id)); /** skip if source does not include typia */ if (!source.includes('typia')) { diff --git a/packages/unplugin-typia/src/core/typia.ts b/packages/unplugin-typia/src/core/typia.ts index 1f86fcb7..d2881c45 100644 --- a/packages/unplugin-typia/src/core/typia.ts +++ b/packages/unplugin-typia/src/core/typia.ts @@ -179,8 +179,7 @@ function transform( }, ); - const resolvedId = resolve(id); - const file = transformationResult.transformed.find(t => resolve(t.fileName) === resolvedId); + const file = transformationResult.transformed.find(t => resolve(t.fileName) === id); if (file == null) { throw new Error('No file found');