soybeanjs/elegant-router

预期之外的import

Azir-11 opened this issue · 1 comments

文件树:
├─home
│ │ index.vue
│ │
│ └─_responsive
│ ├─components
│ │ ├─bill-add
│ │ │ index.vue
│ │ │
│ │ └─bill-list-item
│ │ index.vue
│ │
│ ├─_mobile
│ │ index.vue
│ │
│ └─_pc
│ index.vue

使用下划线让插件忽略路由的生成是正常的,但是elegant/imports.ts中还是会自动import,而且还是三个home

...
export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<RouteComponent>)> = {
  home: () => import("@/views/home/_responsive/_mobile/index.vue"),
  home: () => import("@/views/home/_responsive/_pc/index.vue"),
  home: () => import("@/views/home/index.vue"),
};

下滑线开头的文件夹不是忽略生成路由,而是生成的路由不包含该文件夹
https://github.com/soybeanjs/elegant-router/blob/main/README.zh_CN.md#%E5%BF%BD%E7%95%A5%E6%96%87%E4%BB%B6%E5%A4%B9%E7%9A%84%E8%81%9A%E5%90%88%E8%B7%AF%E7%94%B1

如果想要某文件夹下面不生成路由文件,像 components 这样,配置属性 pageExcludePatterns

https://github.com/soybeanjs/elegant-router/blob/main/README.zh_CN.md#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE

截屏2024-02-01 22 51 39 截屏2024-02-01 22 51 54