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

When using Script Setup syntactic sugar, importing a TS interface or type definition will result in a warning #1266

Closed
zhenzhenChange opened this issue Dec 28, 2020 · 2 comments

Comments

@zhenzhenChange
Copy link
Contributor

Describe the bug

EN: When using Script Setup syntactic sugar, importing a TS interface or type definition will result in a warning

ZH: 当使用Script Setup语法糖时,导入一个TS接口或类型定义会报一个警告


EN: When I import a type that comes with Vue or an interface I wrote (not shown here, of course), I get a warning that my route matches the current component, but there's a problem with the import chain, so the page goes blank

ZH: 当我导入Vue自带的类型或者自己写的接口(当然这里没有展示)时,会报警告,我的路由匹配的就是当前这个组件,不过在导入链出现了问题,所以页面一片空白

use


EN: But I prepended the type marker and the error no longer exists.

ZH: 不过我在前面加上type标识,这个错误就不复存在。

ok


EN: Also when I modify this part of the code by removing the type or adding the type logo, the following happens with hot substitution.

ZH: 另外我在修改这部分代码时,删除type或加上type标识,热替换(HMR)出现以下情况:

HMR

EN: So to narrow it down, my guess: it may be that when recognizing the imported packages, the components and types are not correctly distinguished, resulting in module parsing failure.

ZH: 所以范围缩小,我的猜测:可能是在识別导入的包的时候,没有正确区分出组件与类型,导致模块解析失败。

Reproduction

EN: I tried to reproduce it in codesandbox, but there is no such problem. It seems that this Bug exists by chance, maybe it is a problem of my project.

ZH: 我尝试在codesandbox复现它,但是却没有这个问题,貌似这个Bug存在偶然性,也许是我项目的问题。

System Info

  • required vite version: v1.0.0-rc.13
  • required Operating System: Windows 10 x64
  • required Node version: v15.2.0
  • Optional:
    • npm/yarn version: npm v7.0.8 / yarn v1.22.5
    • Installed vue version (from yarn.lock or package-lock.json): 3.0.4
    • Installed @vue/compiler-sfc version: 3.0.4

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.

log

ImageLink: https://s3.ax1x.com/2020/12/28/rThbEd.png / https://imgchr.com/i/rThbEd

@underfin
Copy link
Member

Duplicated of #731

@zhenzhenChange
Copy link
Contributor Author

Thanks

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

No branches or pull requests

2 participants