Skip to content

Commit b2c593a

Browse files
authored
fix(scan): handle .ts import as .js alias (#9282)
1 parent bbdbac0 commit b2c593a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

playground/vue/TsImport.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<template>
22
<h2>Ts Import</h2>
33
<p class="ts-import">{{ foo }}</p>
4+
<p class="ts-import2">{{ foo2 }}</p>
45
</template>
56

67
<script setup lang="ts">
7-
import { foo } from '/@/TsImportFile.js'
8+
import { foo } from '@/TsImportFile.js'
9+
import { foo as foo2 } from '/@/TsImportFile.js'
810
</script>

playground/vue/__tests__/vue.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test('template/script latest syntax support', async () => {
2525

2626
test('import ts with .js extension with lang="ts"', async () => {
2727
expect(await page.textContent('.ts-import')).toBe('success')
28+
expect(await page.textContent('.ts-import2')).toBe('success')
2829
})
2930

3031
test('should remove comments in prod', async () => {

playground/vue/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { vueI18nPlugin } from './CustomBlockPlugin'
55
export default defineConfig({
66
resolve: {
77
alias: {
8-
'/@': __dirname
8+
'/@': __dirname,
9+
'@': __dirname
910
}
1011
},
1112
plugins: [

0 commit comments

Comments
 (0)