unplugin-auto-import icon indicating copy to clipboard operation
unplugin-auto-import copied to clipboard

Lazy-loaded routing pages do not generate declarations in `auto-imports.d.ts`

Open Mrlilili opened this issue 2 years ago • 7 comments

The type declaration is generated in auto-imports.d.ts only when it needs to be loaded into a lazy-loaded routing page.

The auto-imports.d.ts file is reset every time the project is built; if the lazy loading page is not loaded, the auto-imports declaration will not be generated, and the project file will indicate that the module cannot be found at this time

reproduction project: https://stackblitz.com/github/Mrlilili/auto-import-test?file=src/typings/auto-imports.d.ts

https://user-images.githubusercontent.com/8361655/179142755-ee045cac-d146-434f-a6fe-adf5cde92982.mov

Mrlilili avatar Jul 15 '22 03:07 Mrlilili

Have the same problem

My scenario is some pages with manual import API and some pages without manual import Vue-tsc --noEmit failed directly when I built because auto-imports. D. ts doesn't have this API

Because performance considerations are the result? I really wish the auto-imports. D. ts generation rule would provide a configuration item for the user to decide if it is full

At the moment I have to agree on my own rules of use: either no manual import at all or manual import of all pages

I look forward to your solution

zq0904 avatar Jul 24 '22 10:07 zq0904

I also have the same problem. The scenario is that after packaging, only the routing components loaded lazily by the route cannot jump, prompting that the module cannot be found. My only way is to introduce all the routing components into the routing table

ay192018 avatar Jul 25 '22 03:07 ay192018

yes, some problem router click and add, but reload vite and delete :D

image

productdevbook avatar Aug 01 '22 16:08 productdevbook

同样的问题,希望提供一个可以检查全局文件的命令操作,可以无缺漏的生成.d.ts文件

ll60 avatar Sep 08 '22 07:09 ll60

same problem, i decide to to manual manage *.d.ts, not use auto generate file

llcat avatar Sep 16 '22 07:09 llcat

same problem, i decide to to manual manage *.d.ts, not use auto generate file

项目庞大,并且是多人协作开发的时候,我无法知晓哪些已经使用过的,维护起来苦不堪言,还是需要自动生成的。

ll60 avatar Sep 16 '22 07:09 ll60