假设下面的.vue文件引入了另外的一个vue组件,且没有显示指定 .vue 后缀:
转换前代码:
// 这一句import没有指定ImageList.vue组件的 .vue 后缀,这在普通的.vue文件中可以被ide识别,没有问题。
<script>
import ImageList from '@component/ImageList'
// other
</script>
但是转换为ts版本的.vue文件之后:
<script lang="ts">
// 转换后,如果这里没有指定 .vue 的后缀,那么ts在解析时会报错:无法找到这个模块,因为ts默认只识别 ts tsx jsx这几种,需要显示指定 .vue 文件后缀。
import ImageList from '@component/ImageList'
// other
</script>
如果转换时能自动为相应的vue组件引用添加上 .vue 后缀,会方便很多。
这并不是bug,只是一个优化建议。