Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果源文件import了其他vue组件且没有明确添加.vue后缀,希望转换为ts版本的vue之后可以将.vue后缀给补全。 #6

Open
nongcundeshifu opened this issue Aug 20, 2020 · 1 comment

Comments

@nongcundeshifu
Copy link

假设下面的.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,只是一个优化建议。

@accforgit
Copy link
Owner

@nongcundeshifu get,后面有空会优化下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants