Skip to content

导入类型时省略.tsx后缀,在defineProps<>中使用导入的类型,会提示Failed to resolve import source "xxxx" #10635

Closed
@shawfix

Description

@shawfix

Vue version

3.4.21

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-uqa6ny

Steps to reproduce

  1. constant.tsx 中定义类型“HelloWorldProps”
  2. HelloWorld.vue 中导入“HelloWorldProps”,省略 constant.tsx 的文件扩展名
  3. defineProps<> 使用“HelloWorldProps”

What is expected?

应用正常运行

What is actually happening?

终端报错:

[plugin:vite:vue] [@vue/compiler-sfc] Failed to resolve import source "xxxx"

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions