fix: transform-sfc not parsing .ts file
This commit is contained in:
parent
b2f2981377
commit
6d36be6440
|
|
@ -6,7 +6,7 @@ const require = createRequire(import.meta.url)
|
|||
const { transform } = require('detype')
|
||||
|
||||
export async function transformSFC(opts: TransformOpts) {
|
||||
if (opts.config?.typescript || opts.filename.includes('.ts'))
|
||||
if (opts.config?.typescript)
|
||||
return opts.raw
|
||||
|
||||
return await transformByDetype(opts.raw, opts.filename).then(res => res as string)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ it('transform import', async () => {
|
|||
components: '@/components',
|
||||
utils: '@/lib/utils',
|
||||
},
|
||||
typescript: true,
|
||||
},
|
||||
}),
|
||||
).toMatchSnapshot()
|
||||
|
|
@ -41,6 +42,7 @@ it('transform import', async () => {
|
|||
components: '~/src/components',
|
||||
utils: '~/lib',
|
||||
},
|
||||
typescript: true,
|
||||
},
|
||||
}),
|
||||
).toMatchSnapshot()
|
||||
|
|
@ -61,6 +63,7 @@ it('transform import', async () => {
|
|||
components: '~/src/components',
|
||||
utils: '~/src/utils',
|
||||
},
|
||||
typescript: true,
|
||||
},
|
||||
}),
|
||||
).toMatchSnapshot()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ it('transform tailwind prefix', async () => {
|
|||
components: '@/components',
|
||||
utils: '@/lib/utils',
|
||||
},
|
||||
typescript: true,
|
||||
},
|
||||
baseColor: 'stone',
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user